从C#中的MailItem获取命名的MAPI属性 [英] Get named MAPI Property from MailItem in C#

查看:314
本文介绍了从C#中的MailItem获取命名的MAPI属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C#开发一个Outlook 2010自定义插件.这是我第一次使用C#(通常我是Java专家).

I'm developing an Outlook 2010 custom plugin in C#. This is my first time using C# (I'm a java guy normally).

我想访问的消息上有一个命名的(自定义)MAPI属性,但这样做有麻烦.我的理解是,在Outlook 2007中引入了PropertyAccessor对象,该对象允许轻松访问命名的MAPI属性.我按照以下文档中的说明进行操作:

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

我可以使用Outlook Spy在邮件中看到要访问的命名MAPI属性.从Outlook Spy中,我可以获得有关该属性的以下信息:

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

因此,我尝试了以下代码(对象邮件是MailItem的有效实例):

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");

这会产生以下异常:

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

我的理解是,这仅对于2007之前的Outlook版本是必需的.任何帮助深表感谢!

My understanding was that this was only necessary for pre 2007 versions of Outlook. Any help is much appreciated!

推荐答案

OutlookSpy将在IMessage窗口的DASL编辑框中为您提供DASL属性名称.

OutlookSpy will give you the DASL property name in the DASL edit box in the IMessage window.

这篇关于从C#中的MailItem获取命名的MAPI属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆