OL: PathName Property Only Valid for Linked Files (326247)



The information in this article applies to:

  • Microsoft Outlook 2002
  • Microsoft Outlook 2000
  • Microsoft Outlook 98
  • Microsoft Outlook 97

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.

REFERENCES

For additional information about available resources and answersto frequently asked questions about Microsoft Outlook solutions, click the article numbers below to view the articles in the Microsoft Knowledge Base:

287530 OL2002: Questions About Custom Forms and Outlook Solutions

146636 OL2000: Questions About Custom Forms and Outlook Solutions

182349 OL98: Questions About Custom Forms and Outlook Solutions

170783 OL97: Questions About Customizing or Programming Outlook

285202 OL2002: List of Outlook Object Model Constants


Modification Type:MinorLast Reviewed:3/1/2004
Keywords:kbhowto KB326247 kbAudDeveloper