How do you implement attachments in UAPM using URLs (Universal Resource Locators)?
Unicenter Asset Portfolio Management allows you to associate files, known as attachments, to most UAPM objects. You can attach word processing documents, text files, spreadsheets, images, faxes, and any other file type your computer knows how to handle, to UAPM objects such as Assets, Models, Companies, Locations, Contacts, Organizations, and Legal Documents.
The association between a UAPM object and the attachments defined for that object is stored in the MDB database - the UAPM repository. The MDB also contains the specific location of each attachment. When you create an attachment, you must provide its location in the form of a URL address or a UNC (Universal Naming Convention) share. You can choose to store some attachments by URL and others by UNC, and you can view either directly from within UAPM. The attachments themselves must be stored in directories on the IIS Server or any other location which is accessible to the IIS Server. Support for using mapped drives to store attachments has been discontinued as of UAPM version 11.
This article explains how to use URLs to store attachments. For information on using UNC shares, refer to the technical document How To Implement Attachments in a Secure Environment available on this site.
Why use URLs?
If you are familiar with specifying attachments by UNC share, \\ServerName\ShareName, you know that you are required to specify the UNC base attachment path in the UAPM Configurator utility before you can create attachments, and that all new attachments will be stored in a location relative to this UNC base attachment path. Using UNC shares, you cannot have multiple base paths for attachments, so you must store all attachment files at or below this location. You can get around this problem by using URL addresses to define the location of your attachments. UAPM does not use the Configurator to determine a base URL. Instead, each time you create a new attachment you specify the complete URL address for that attachment - and each attachment URL can be unique.
How to Specify a URL for an attachment
A URL address is always of the form: http[s]://ServerName/VirtualDirectoryName/FileName.ext. To specify an attachment by URL follow these steps:
- From the UAPM Home Page, select the object type you wish to add an attachment to (Asset, Model, Contact, Location, Company, Legal Document, or Organization). Note that you cannot add an attachment to a Site.
- Use Basic or Advanced Search to select a specific object of that type.
- In the left tree view, expand Attachments for <object>
- Select <New>
- The Attachment window will open in the right pane.
- For Attachment Type, select URL.
- The Attachment window will change to display the fields available for URL attachment types.
- The optional text you enter in the Description field will be prepended to the URL address and appear in the list of attachments in the attachments list tree in the left pane after you have saved the attachment. Entering a brief description will make it easier for users to identify the purpose of the attachment. Without it, users will have to decipher the URL to determine the nature of the attachment.
- The File Path field is required. Enter the complete URL address to the attachment in the form: http[s]://<ServerName>/<VirtualDirectoryName>/<FileName.Ext>.
- You will receive an error if the File Path does not begin with http:// or https://.
- You can specify local HTTPS addresses here if your IIS Server has been configured to serve SSL pages.
- You can enter addresses outside your local domain such as http://www.ca.com.
- UAPM does not attempt to validate the address you enter. You can enter a file name that does not yet exist and copy it to this location later using Windows Explorer, if desired.
- If the attachment file already exists at the File Path location you entered, you can use the View button to test the attachment before selecting Save.
- Click the Save button after entering all information. You will receive the message "Confirmation: The save has completed successfully" if there are no errors.
- The new attachment will appear in the left pane tree view under Attachments for <object> in the form: <Description> - <http[s]://Address/File.Ext>
Once you have saved an attachment in UAPM, it is not possible to modify the entry. If you need to change the description or URL for an attachment after it has been saved, you must delete the attachment from UAPM and create a new one incorporating the changes. Note that deleting an attachment from UAPM does not delete the actual file - only the entry for it in UAPM.
How to Implement Attachments in IIS 6.0
Without doing any special configuration in IIS you can specify internet URLs as attachment paths and use these to display web pages from other sites. If your users have permission to access the Internet from within your corporate firewall, then they can view attachments that are actually web pages from external sites. For instance, you can create an attachment of http://www.ca.com, and users will see the CA home page when they open the attachment.
When attachments are specified by a local URL on your server or any other server in your local domain, you cannot view them until they are "served" to the user in exactly the same way as pages on a web site. Even attachments which are not html, xml, or other browser-type files are opened for the user using the same rules as web sites. This means that in order to view attachments stored on a server in your local domain, you must configure IIS to serve the files, and you must configure both IIS and NTFS file permissions to allow your users to view the attachments.
A Simple Example
IIS is capable of serving files located on the local IIS server, remote servers located in your domain, and even servers located in other domains. This article discusses the steps you need to take to serve files co-located on your IIS server so that UAPM users can view attachments stored by URL address.
Create a folder to contain your attachment files
- In Windows Explorer, create a new folder called "AttachmentsFolder"
- Right-Click on this folder and select Sharing and Security
- In the Sharing tab, select Share this folder with Share name AttachmentsFolder
- Click the Permissions button and grant Everyone Full Control
- Select the Security tab
- Select the group Users (<ServerName>\Users)
- Grant Full Control
- Click OK to save these settings
Configure IIS to serve your attachment files
- As the local administrator, Open IIS Manager
- Start, All Programs, Administrative Tools, Internet Information Services (IIS) Manager
- Expand <Server Name> (Local Computer)
- Expand Web Sites
- Select Default Web Site
- Right-Click Default Web Site
- Select New
- Select Virtual Directory
- The Virtual Directory Creation Wizard will open
- Click Next
- You will be prompted to enter an Alias name. Enter attachments
- This will be the name of your new Virtual Directory in IIS.
- Click Next
- For Path, browse to or type in the directory you created to hold attachments
- Do not enter a mapped network drive. IIS does not support using mapped drives for Virtual Directories.
- Click Next
- Virtual Directory Access Permissions, allow the following permissions:
- Select Read
- Do not select Run scripts, Execute, Write, or Browse
- Click Next to complete the wizard.
- You should see, You have successfully completed the Virtual Directory Creation Wizard.
- Click Finish.
In IIS Manager you should now see an entry for your new virtual directory Attachments under Default Web Site
Test the Virtual Directory
- Go back to Windows Explorer and copy some files into C:\AttachmentsFolder, or create a new file with Notepad in this folder named Test.txt and save it.
- Return to IIS Manager and refresh the page.
- You should see the new files appear in the Attachments virtual directory automatically.
- In Windows Explorer, create a new folder inside C:\AttachmentsFolder.
- Create the new file test2.txt in Folder2 and save it.
- Return to IIS Manager and refresh the page.
- You should see the new folder you created and the new file you put in it.
- Open Internet Explorer browser.
- In the address bar enter YourServerName/Attachments/test.txt
- You should see your test.txt file displayed in the browser window.
- In the address bar enter YourServerName/Attachments/Folder2/test2.txt
- You should see the file test2.txt displayed in the browser window.
- In UAPM, create a new URL attachment for any object.
- For File Path enter http://<YourServerName>/Attachments/Folder2/test2.txt
- Click the View button.
- The file test2.txt should be displayed in the browser window.
To learn more about securing attachments in UAPM and limiting which users can view them, see How To Implement Attachments in a Secure Environment, available on this web site.
To learn more about how to configure IIS to serve attachments located on different servers, see How to access network files from IIS applications