How do you implement attachments in UAPM using URLs (Universal Resource Locators)?

Document ID : KB000026308
Last Modified Date : 14/02/2018
Show Technical Document Details

Question:

How do you implement attachments in UAPM using URLs (Universal Resource Locators)?

Answer:

Background:

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.

Solution:

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:

  1. 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.

  2. Use Basic or Advanced Search to select a specific object of that type.

  3. In the left tree view, expand Attachments for <object>

  4. Select <New>

  5. The Attachment window will open in the right pane.

  6. For Attachment Type, select URL.

  7. The Attachment window will change to display the fields available for URL attachment types.

  8. 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.

  9. The File Path field is required. Enter the complete URL address to the attachment in the form: http[s]://<ServerName>/<VirtualDirectoryName>/<FileName.Ext>.

    1. You will receive an error if the File Path does not begin with http:// or https://.

    2. You can specify local HTTPS addresses here if your IIS Server has been configured to serve SSL pages.

    3. You can enter addresses outside your local domain such as http://www.ca.com.

    4. 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.

  10. 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.

  11. Click the Save button after entering all information. You will receive the message "Confirmation: The save has completed successfully" if there are no errors.

  12. 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

  1. In Windows Explorer, create a new folder called "AttachmentsFolder"

    1. C:\AttachmentsFolder

  2. Right-Click on this folder and select Sharing and Security

    1. In the Sharing tab, select Share this folder with Share name AttachmentsFolder

    2. Click the Permissions button and grant Everyone Full Control

  3. Select the Security tab

    1. Select the group Users (<ServerName>\Users)

    2. Grant Full Control

  4. Click OK to save these settings

Configure IIS to serve your attachment files

  1. As the local administrator, Open IIS Manager

    1. Start, All Programs, Administrative Tools, Internet Information Services (IIS) Manager

    2. Expand <Server Name> (Local Computer)

    3. Expand Web Sites

    4. Select Default Web Site

      1. Right-Click Default Web Site

      2. Select New

      3. Select Virtual Directory

    5. The Virtual Directory Creation Wizard will open

    6. Click Next

    7. You will be prompted to enter an Alias name. Enter attachments

    8. This will be the name of your new Virtual Directory in IIS.

    9. Click Next

    10. For Path, browse to or type in the directory you created to hold attachments

      1. C:\AttachmentsFolder

      2. Do not enter a mapped network drive. IIS does not support using mapped drives for Virtual Directories.

      3. Click Next

    11. Virtual Directory Access Permissions, allow the following permissions:

      1. Select Read

      2. Do not select Run scripts, Execute, Write, or Browse

      3. Click Next to complete the wizard.

    12. You should see, You have successfully completed the Virtual Directory Creation Wizard.
      1. 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

  1. 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.

  2. Return to IIS Manager and refresh the page.

  3. You should see the new files appear in the Attachments virtual directory automatically.

  4. In Windows Explorer, create a new folder inside C:\AttachmentsFolder.

  5. C:\AttachmentsFolder\Folder2

  6. Create the new file test2.txt in Folder2 and save it.

  7. Return to IIS Manager and refresh the page.

  8. You should see the new folder you created and the new file you put in it.

  9. Open Internet Explorer browser.

  10. In the address bar enter YourServerName/Attachments/test.txt

  11. You should see your test.txt file displayed in the browser window.

  12. In the address bar enter YourServerName/Attachments/Folder2/test2.txt

  13. You should see the file test2.txt displayed in the browser window.

  14. In UAPM, create a new URL attachment for any object.

  15. For File Path enter http://<YourServerName>/Attachments/Folder2/test2.txt

  16. Click the View button.

  17. The file test2.txt should be displayed in the browser window.

Further Reading

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