c# - 如何更新 Exchange Web Api 中的联系人项目

标签 c# exchangewebservices exchange-server ews-managed-api

我尝试用空字符串更新 EWS 中的联系人属性,但失败了。我不知道为什么。

 // works fine
 contact.Company = "SomeCompany";
 contact.Update(ConflictResolutionMode.AlwaysOverwrite);

 // failed in Update with a service response exception
 contact.Company = "";
 contact.Update(ConflictResolutionMode.AlwaysOverwrite);

我尝试了 null 和 string.Empty,但效果相同。 我究竟做错了什么?

最佳答案

您确定Contact 上有Company 属性吗?类型?我只看到 CompanyName可以通过以下方式更新的属性没有任何问题(至少在我尝试时):

var service = GetService();
var view = new ItemView(1);
var searchFilter = new SearchFilter.IsEqualTo(ContactSchema.EmailAddress1, "test@domain.dk");
var contacts = service.FindItems(WellKnownFolderName.Contacts, searchFilter, view);

var contact = contacts.ElementAt(0) as Contact;

// Works fine.
contact.CompanyName = "SomeCompany";
contact.Update(ConflictResolutionMode.AlwaysOverwrite);

// Works fine as well.
contact.CompanyName = "";
contact.Update(ConflictResolutionMode.AlwaysOverwrite);

关于c# - 如何更新 Exchange Web Api 中的联系人项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9480467/

相关文章:

c# - OOP 中的默认参数是不好的做法吗?

c# - int test[] = new int[0] 是什么意思?

c# - Task.Run 和 UI 进度更新

node.js - 使用 Exchange EWS SOAP,如何获取给定用户名的电子邮件地址

c# - EWS : Accessing an appointments recurrence pattern

powershell - 在 Exchange 2007 中收到电子邮件时发送通知

c# - .NET 中的点有多贵?

c# - 使用 Oauth 和 full_access_as_user 对 EWS 进行身份验证

同步到 Exchange 帐户时,iOS 无法更新日历事件

powershell - 如何在 Exchange Online 的 Powershell 代码中将字符串转换为 bool 值?