【问题标题】:Getting ExtendedPropertyDefinition values from EWS in Outlook addin从 Outlook 插件中的 EWS 获取 ExtendedPropertyDefinition 值
【发布时间】:2013-02-15 16:28:02
【问题描述】:

我正在使用 EWS 网络服务对邮箱进行自动处理,并将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;

【问题讨论】:

    标签: c# winforms outlook-addin exchangewebservices


    【解决方案1】:

    好的,我终于明白了。我必须使用 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");
    

    【讨论】:

      猜你喜欢
      • 2016-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-30
      • 1970-01-01
      相关资源
      最近更新 更多