如何在Exchange Web Api中更新联系人项目 [英] How I can update a contact item in Exchange Web Api
本文介绍了如何在Exchange Web Api中更新联系人项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用空字符串更新EWS中的联系人属性,但失败.我不知道为什么.
I try to update a contact property in EWS with an empty string but it fails. I have no idea why.
// 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,但效果相同. 我究竟做错了什么?
I try null and string.Empty but its the same effect. What am I doing wrong?
推荐答案
Are you sure there is a Company
property on the Contact
type? I only see a CompanyName
property which can be updated in the following way without any problems (at least when I try it):
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);
这篇关于如何在Exchange Web Api中更新联系人项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文