I am attempting to retrieve some built-in (even custom?) properties from Word/Excel documents in attachments without saving temp files and opening them in the respective Application. I tried attaching them in a MailItem
and a DocumentItem
.
The properties I am interested in would be: Author, Title, LastSaveDtm, etc. Outlook seems to be able to get them, because the Author name appears at the top of the Preview Pane of a DocumentItem
.
The only way I could find to get those properties is using the following methods as described here:
varProp = MailItem.PropertyAccessor.GetProperties(SchemaName)
varProp = DocumentItem.PropertyAccessor.GetProperties(SchemaName)
varProp = MailItem.Attachments(1).PropertyAccessor.GetProperties(SchemaName)
varProp = DocumentItem.Attachments(1).PropertyAccessor.GetProperties(SchemaName)
The SchemaName
's are defined in here: [MS-OXPROPS]: Exchange Server Protocols Master Property List
Some interesting definitions from the specs:
- named property: A property that is identified by both a GUID and either a string name or a 32-bit identifier
- Document object: A Message object that represents a single file, such as a document generated by a word-processing application. The Message object contains the file as an Attachment object and includes additional properties to describe the file.
The properties I am trying to retrieve do not have a MAPI tag syntax (canonical name like PidTagPropName) to be used with the proptag
namespace (which works from what I have tested*) nor a MAPI id syntax (canonical name like PidLidPropName) to be used with the id
namespace, but only have a MAPI string syntax (canonical name like PidNamePropName) to be used with the string
namespace.
Here is what I tried for the SchemaName
:
"http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/Author"
"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/Title"
"urn:schemas-microsoft-com:office:office#Author"
"urn:schemas-microsoft-com:office:office#Title"
None of them works.
This document says that "named properties are defined by clients and occasionally service providers"
I have also seen nomewhere that document properties should be "automatically published in MAPI".
So what I am doing wrong?
(*) SchemaName
's that work (PidTagSubject):
"http://schemas.microsoft.com/mapi/proptag/0x0037001E"
"http://schemas.microsoft.com/exchange/subject-utf8"