[EWS / C#]获取字段“From”的值和“注释”联系方式 [英] [EWS/C#] Get value for the field "From" and "Notes" for the Contact

查看:124
本文介绍了[EWS / C#]获取字段“From”的值和“注释”联系方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我正在处理联系人记录。我正在使用带有托管API的Exchange Web服务来获取联系人记录。


获取我正在使用的联系方式的指定字段&bbsp方法
LoadPropertiesForItems
并传递
  PropertySet
object。我需要 默认 字段 """和"注释"
Contact 记录。这些字段未在
ContactSchema 中指定。


要检索这些字段我正在使用ExtentedPropertyDefinition ...


ExtendedPropertyDefinition fromField =
new
ExtendedPropertyDefinition (66,
MapiPropertyType 。字符串);


propertySet.Add(fromField);


ExtendedPropertyDefinition   noteField =
new
ExtendedPropertyDefinition (4096,
MapiPropertyType 。String);


propertySet.Add(noteField); 


我正在传递TAG值
66代表'From'
上述方法中 4096 for"Note" 。 我已经使用试错法找到了这些值。我不确定这些是获取字段值的正确方法。


如果有任何其他方法可以让我获取这些值。
如果没有,请确认我在我的程序中使用的这些TAG值。所以,我可以继续使用它。


请尽快回复。

解决方案

您使用的属性是PidTagSentRepresentingName
http://msdn.microsoft.com/en-us/library/cc842405%28office.12%29.aspx
 和PR_BODY_W
http://msdn.microsoft.com/en-us/library/bb446140。 aspx  哪些是有效的,可以使用。我要指出的一件事是,因为一个属性不在ContactSchema中而不是
意味着你可以使用它,因为联系人是从ItemType派生出ItemSchema中可用的任何属性都可供您使用,例如因为Notes字段只是消息的主体,您可以通过这种方式检索它。我建议你看看
的方式对象在deb中返回在Visual Studio中进行ug会话,否则如果您可以获得Inside Exchange Web Services一本书的副本,这也会详细解释这一点。


Cheer

Glen


In my project I am dealing with Contact Record. I am using Exchange Web Service with Managed API to get Contact records.

For getting specified fields of the Contact I am using method LoadPropertiesForItems and passing PropertySet object. I need value for the default fields "From" and "Notes" of Contact Record. These fields are not specified in ContactSchema.

To retrieve these fields I am using ExtentedPropertyDefinition...

ExtendedPropertyDefinition fromField = new ExtendedPropertyDefinition(66, MapiPropertyType.String);

propertySet.Add(fromField);

ExtendedPropertyDefinition noteField = new ExtendedPropertyDefinition(4096, MapiPropertyType.String);

propertySet.Add(noteField); 

I am Passing TAG value 66 for 'From' and 4096 for 'Note' in above methods. I have found these values using trial and error method. I am not sure these is the correct way to get the field values.

Please let me if any other way for getting these values. If not, Please confirm these TAG value i am using in my Program. So, i can continue using that.

Please reply soon.

解决方案

The properties you are using are PidTagSentRepresentingName http://msdn.microsoft.com/en-us/library/cc842405%28office.12%29.aspx and PR_BODY_W http://msdn.microsoft.com/en-us/library/bb446140.aspx which are valid and okay to use. The one thing i would point out is that just because a property isn't in the ContactSchema doesn't mean you can use it because a contact is derived from ItemType any of the properties available in the ItemSchema will be available to you eg because the Notes field is just the body of the message you can retrieve it this way. I would suggest you have a look at the way the objects are return in a debug session in Visual Studio otherwise if you can get you hands on a copy of the Inside Exchange Web Services book this also explains this in detail.

Cheer
Glen


这篇关于[EWS / C#]获取字段“From”的值和“注释”联系方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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