In my c# VSTO Outlook project I am using the GetNamesFromIDs to get a property name from one message and then adding it to a second message with GetIDsFromNames with the MAPI_CREATE
flag set so that the property is added. I then add the value.
My understanding of GetIDsFromNames is that when it sets a "new" property then a new and unique tag is generated. This is done so that tags do not clash.
No.2 I cannot seem to read anywhere.
Yes, that is exactly how it works - once a mapping it created, is stays the same for the lifetime of the parent message store. You can see existing mapping in OutlookSpy (I am its author) - click IMsgStore
button (or IMAPIFolder
or IMessage
) and then GetNamesFromIDs
button.
Yes, you always need to set the type. Keep in mind that once a property is used (i.e. used to set a property) with a particular type (unless it is PT_STRING8
vs PT_UNICODE
), you will not be able to use that property with a different type.