开发者

Get named MAPI Property from MailItem in C#

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 MailIte开发者_StackOverflow中文版m):

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!


What happens if you try

mail.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x80BE0102");

?


Microsoft's MFCMapi is also a great tool to locate the DASL and view all MAPI properties.


OutlookSpy (I am its author) will give you the DASL property name in the DASL edit box in the IMessage window (select a message with the property set, click IMessage button, select the property, look at the DASL edit box)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜