I'm developing an Outlook 2010 custom plugin in C#. This is my first time using C# (I'm a java guy normally).
There is a named (custom) MAPI property on a message that I would like to access and am having trouble doing so. My understanding is that in Outlook 2007 the PropertyAccessor object was introduced which allows easy access to named MAPI properties. I followed the instructions from the following documentation:
http://msdn.microsoft.com/en-us/library/ff868915.aspx
I can see the named MAPI property I want to access on the message using Outlook Spy. From Outlook Spy I can get the following information about the property:
GUID: {00020329-0000-0000-C000-000000000046}
Tag num: 0x80BE0102
ID: PR.AFU.MESSAGE.RETRIEVE.INFO
Type: PT_BINARY
So I tried the following code (Object mail is a valid instance of MailItem):
mail.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/id/{00020329-0000-0000-C000-000000000046}/80BE0102");
This produces the following exception:
The property "http://schemas.microsoft.com/mapi/id/{00020329-0000-0000-C000-000000000046}/80BE0102" is unknown or cannot be found
So I'm wondering how to actually get this property? Am I forming the namespace reference incorrectly? Or do I need to use an approach as outlined in this example:
http://www.outlookcode.com/codedetail.aspx?id=1112
My understanding was that this was only necessary for pre 2007 versions of Outlook. Any help is much appreciated!
OutlookSpy will give you the DASL property name in the DASL edit box in the IMessage window.
What happens if you try
?
Microsoft's MFCMapi is also a great tool to locate the DASL and view all MAPI properties.