用户属性与MAPI ExtendedPropertyDefinition [英] User Properties vs MAPI ExtendedPropertyDefinition

查看:72
本文介绍了用户属性与MAPI ExtendedPropertyDefinition的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用EWS托管API创建的扩展属性定义与使用outlook addin创建的用户属性之间有什么区别。 

What is the difference between Extended Properties Definition created with EWS Managed API and User properties created with the outlook addin. 

我可以使用这样的自定义属性编写  EWS托管API:

I can write a custom property like this using the  EWS Managed API:

     private void setProperty(Item item, Property prop) { 

          item.Load();

         item.Load();

          item.SetExtendedProperty(Prop.name,Prop.value); 

          item.SetExtendedProperty(Prop.name, Prop.value); 

          ConflictResolutionMode mode = ConflictResolutionMode.AlwaysOverwrite; 

          ConflictResolutionMode mode = ConflictResolutionMode.AlwaysOverwrite; 

          item.Update(模式); 

          item.Update(mode); 

      } 

      } 

其中Prop是一个对象,它包含扩展属性定义和对象值:

Where Prop is an object, that contains an Extended Property definition and object value:

ExtendedPropertyDefinition prop = new ExtendedPropertyDefinition(

DefaultExtendedPropertySet.PublicStrings," Prop",MapiPropertyType.String);

DefaultExtendedPropertySet.PublicStrings, "Prop", MapiPropertyType.String);

使用此方法设置Outlook加载项用户属性的内部:

Inside of the Outlook Add-In User Properties are set using this method:

mailItem.UserProperties.Add("PropName", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText).Value = PropValue;

在EWS托管API中如何访问outlook addin中设置的这些属性? 

In EWS Managed API how do you access these properties set in the outlook addin? 

第二个问题:

Second Question:

使用UserProperties,Add方法设置这些属性,在消息发送时保留。使用SetExtendedProperty设置为mailItem的属性,EWS在消息发送中保持不变。如果没有,可以使用哪些财产? 

These properties set using the UserProperties, Add method, persist on message send. Do properties set to a mailItem using SetExtendedProperty, of EWS persist across message send. If not what property can be used to do so? 

Milton Cody

Milton Cody

推荐答案

用户属性只是扩展MAPI属性所以没有区别在该级别和持久性方面,要在EWS中访问它们,您需要定义要使用的属性,将其添加到属性集,然后加载该属性集。
例如

User properties are just Extended MAPI properties so there is no difference at that level and in regards to persistence, to access them in EWS you need to define the property you want to use, Add it to a property set and then load that property set. eg

            ExtendedPropertyDefinition prop = new ExtendedPropertyDefinition( DefaultExtendedPropertySet.PublicStrings, "Prop", MapiPropertyType.String);
            PropertySet PropSet = new PropertySet(BasePropertySet.FirstClassProperties) { prop };
            Message.Load(PropSet);
            Object Propval = null;
            if (Message.TryGetProperty(prop, out Propval))
            {
                Console.WriteLine(Propval);
            }

使用这些属性的唯一区别是,通过EWS添加的属性不会添加UserProperties Blob,这在

https://social.technet.microsoft.com/Forums/office/en-US/2a98b4ab-0fbc-4863-8303-48711a18a050/custom-properties-added-by-ews-not -visible-in-outlook?forum = interchangevrdevelopment
 这意味着你总是需要在OOM中使用PropertryAccessor,如果
这就是你使用它们的方式。

The only difference when using these properties is that properties added via EWS aren't added the UserProperties Blob which is described in https://social.technet.microsoft.com/Forums/office/en-US/2a98b4ab-0fbc-4863-8303-48711a18a050/custom-properties-added-by-ews-not-visible-in-outlook?forum=exchangesvrdevelopment which just means you always need to use the PropertryAccessor in OOM if this is the way your using them.

干杯

Glen

Cheers
Glen





这篇关于用户属性与MAPI ExtendedPropertyDefinition的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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