Microsoft KB Archive/326247

= OL: PathName Property Only Valid for Linked Files =

Article ID: 326247

Article Last Modified on 3/1/2004

-

APPLIES TO


 * Microsoft Outlook 2002 Standard Edition
 * Microsoft Outlook 2000 Standard Edition
 * Microsoft Outlook 98 Standard Edition
 * Microsoft Outlook 97 Standard Edition

-



This article was previously published under Q326247



SUMMARY
In the Outlook object library, the PathName property of an attachment returns a read-only value that represents the full path to an attached file. However, this property is only valid for linked files.



MORE INFORMATION
When Outlook programmatically attaches a file, the value of the OlAttachmentType constant specifies how the file will exist in the item.

There are three constants that are used to specify how a file or item is attached:
 * OlByReference - Create a shortcut to an external file. This provides a link in the item to the file's external location.
 * OlByValue - Embed a copy of the host file as an attachment in the item. The file that is attached is a copy of the specified file and does not link back to the original file.
 * OlEmbeddedItem - Create a shortcut to an Outlook item. Attach an Outlook-specific file such as a contact item.

Only attachments that are added by using the OlByReference constant have a valid PathName property. The PathName property returns the path of the attachment on the host computer.

An attachment that is added by using the OlByValue constant does not have a valid PathName property because the attachment is a new copy and there is no link between the attached copy and the host file.

An attachment that is added by using the OlEmbeddedItem constant also does not have a valid PathName property because the attachment is an actual Outlook item and does not reside on the file system.

There is no MAPI or Outlook object model property that returns the original path of an attached file when Outlook uses the OlByValue constant or the OlEmbeddedItem constant to attach files. Outlook does not store the original path of an attachment if it is embedded in the item, even as an underlying MAPI property. Only the OlByReference value is designed to return the path of the host file because Outlook does keep track of the original source location of a linked file.

