如何使用Exchange Web服务托管API设置联系人标题 [英] How to set the contact title using Exchange Web Services Managed API

查看:47
本文介绍了如何使用Exchange Web服务托管API设置联系人标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用EWS API创建新的联系人.除了联系人标题属性,我可以设置所有需要的值.我尝试了代码:

I'm trying to create a new contact using the EWS API. I can set all the values i needed except the contact title property. I tried the code:

oContact = new Contact(oService);
oContact.GivenName = "John";
oContact.Surname = "Doe";
oContact.Displayname = oContact.Surname;

// set the title property as extended property
// reference: http://msdn.microsoft.com/en-us/library/gg274394.aspx
ExtendedPropertyDefinition oTitleProp = new ExtendedPropertyDefinition(
  new Guid("{00062004-0000-0000-C000-000000000046}"),
  0x3A45,
  MapiPropertyType.String);
oContact.SetExtendedProperty(oTitleProp, "Mr.");

oContact.Save();

我没有收到错误,但是当我在Outlook 2010中检查标题字段时,它为空.我正在使用Exchange 2010.

I'm not getting an error but when i check the title field in outlook 2010, it's empty. I’m using Exchange 2010.

有什么想法我做错了吗?

Any ideas what i did wrong?

亲切的问候

Volkmar

推荐答案

简短回答

在创建扩展属性定义时,不要使用上面的代码,而不要在指定propertySetId的位置使用构造函数.而是这样构造它:

When creating the extended property definition, instead of the code you have above, don't use the constructor where you specify the propertySetId. Instead, construct it like this:

ExtendedPropertyDefinition oTitleProp = new ExtendedPropertyDefinition(
    0x3A45,
    MapiPropertyType.String);

更长的答案

您从Microsoft获得的参考很有趣.通过阅读有关在Microsoft Exchange Server 2007 Web服务内部"中的扩展属性的章节,我始终认为,对于不在自定义范围(小于0x8000的扩展范围)中的扩展属性,您在引用它们时会忽略propertySetId,因此很有趣该页面,Microsoft似乎暗示您会使用它.

That reference you have from Microsoft is interesting. From reading the chapter about extended prorperties in Inside Microsoft Exchange Server 2007 Web Services, I always thought that for extended properties not in the custom range (those below 0x8000), you'd leave out the propertySetId when referencing them, so it's interesting that on that page, Microsoft seems to imply you'd use it.

关于其价值,有一个免费提供的Microsoft Exchange Server 2007 Web服务内部附录(附录C),该附录还在

For what it's worth, there's a freely available appendix (Appendix C) to Inside Microsoft Exchange Server 2007 Web Services that also documents extended properties at http://www.microsoft.com/mspress/companion/9780735623927/ that might be clearer than that Microsoft page on when to use propertySetId and when not to.

http://msdn.microsoft.com/en-us/library/cc433490(EXCHG.80).aspx

这篇关于如何使用Exchange Web服务托管API设置联系人标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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