2

我使用 EWS Web 服务对邮箱进行自动处理,并分配ExtendedPropertyDefinition给这样的消息:

Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition extendedPropertyDefinition =
                           new Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, "Archivado", MapiPropertyType.String);

  msgComplete.SetExtendedProperty(extendedPropertyDefinition, iddoc);
                             msgComplete.Update(ConflictResolutionMode.AlwaysOverwrite);

另一方面,我正在开发一个 Outlook 插件,该插件需要在每次邮件点击时进行评估,如果该邮件已ExtendedPropertyDefinition定义此名称,但我不知道如何使用 Outlook 类从 Outlook 插件恢复扩展属性。

我不介意是否必须使用另一种属性才能从两个框架中访问。

我尝试在 Outlook 中使用以下属性,但没有成功;

item.Userproperties;

item.PropertyAccesor.GetProperty("Archivado"); 

item.ItemProperties;
4

1 回答 1

2

好的,我终于明白了。我必须使用 Guid 创建 ExtendedPropertyDefinition 并使用属性上的架构从 Outlook 中恢复它,如下所示:

//Setting the property with Exchange webservice:

string guid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";

Guid MY_PROPERTY_SET_GUID = new Guid(guid); 

Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition extendedPropertyDefinition =
new Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(MY_PROPERTY_SET_GUID, "Archivado", MapiPropertyType.String);


//Recover the property using Outlook:


Outlook.MailItem item = (Outlook.MailItem)e.OutlookItem;

Outlook.UserProperties mailUserProperties = item.UserProperties;

dynamic property=item.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/string/{Outlook.MailItem item = (Outlook.MailItem)e.OutlookItem;

            Outlook.UserProperties mailUserProperties = item.UserProperties;
            dynamic property=item.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/string/{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}/Archivado");
于 2013-03-01T08:30:31.700 回答