Contact.Update(...)EWS托管API的问题 [英] Problem with Contact.Update(...) EWS Managed API

查看:74
本文介绍了Contact.Update(...)EWS托管API的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我们目前正在自己​​的CRM软件和Exchange之间编写基于服务器的同步工具。几个月前,我已经完成了一项服务,将我们的SQLServer与Exchange的约会同步。它工作正常。现在我们想要从CRM同步联系人 - >交换。创建联系人没有问题(不包括"标题":))。但是现在我对Contact对象的Update(...)方法有一点问题。

如果我看到联系人的数据发生了变化,我们将所有数据设置为新的并调用更新方法。但是在这里我得到了一个例外:变更描述中的对象必须包含一个且只有一个要修改的属性
但是...尝试不同的方式并跳转在我的代码中,我发现我们可以设置多个属性并调用Update(...)而不会出现异常。
例如:


Hello,

we are currently writing a server based synchronisation tool between our own CRM Software and Exchange. A few month ago I have completed a service to sync appointments from our SQLServer to Exchange. It works fine. Now we want to sync Contacts from CRM -> Exchange. Creating Contacts is no problem (excluding the "Title" :) ). But now I have a little problem with the Update( ... ) Method from the Contact object.

In the case that I see that data from a contact has changed, we set all data new and call the update method. But here i got a Exception that says: An object within a change description must contain one and only one property to modify

But... After trying out different ways and jumping around in my code, I discoverd that we can set more than one property and call Update( ... ) without getting a exception.
For Example:

If Not String.IsNullOrEmpty(company.InterNet) Then mContactperson.BusinessHomePage = company.InterNet
If Not String.IsNullOrEmpty(company.Telefon) Then mContactperson.PhoneNumbers(PhoneNumberKey.BusinessPhone) = company.Telefon
If Not String.IsNullOrEmpty(company.Telefon) Then mContactperson.PhoneNumbers(PhoneNumberKey.BusinessFax) = company.Telefax


更新(...)有效...




Update( ... ) works...

Also

' mContactperson is a 'Contact' object
If Not String.IsNullOrEmpty(company.InterNet) Then mContactperson.BusinessHomePage = company.InterNet
If Not String.IsNullOrEmpty(company.Telefon) Then mContactperson.PhoneNumbers(PhoneNumberKey.BusinessPhone) = company.Telefon
If Not String.IsNullOrEmpty(company.Telefon) Then mContactperson.PhoneNumbers(PhoneNumberKey.BusinessFax) = company.Telefax

Dim PHAdress As New PhysicalAddressEntry
If Not String.IsNullOrEmpty(company.Adresse.Ort) Then PHAdress.City = company.Adresse.Ort
If Not String.IsNullOrEmpty(company.Adresse.Staat) Then PHAdress.State = company.Adresse.Staat
If Not String.IsNullOrEmpty(company.Adresse.Plz) Then PHAdress.PostalCode = company.Adresse.Plz

mContactperson.PhysicalAddresses.Item(PhysicalAddressKey.Business) = PHAdress


更新(...)有效...

但是当我现在设置另一个像这样的物理地址...... br $> b $ b

Update( ... ) works...

But when I now set another physical adress like this...

' mContactperson is a 'Contact' object
If Not String.IsNullOrEmpty(company.InterNet) Then mContactperson.BusinessHomePage = company.InterNet
If Not String.IsNullOrEmpty(company.Telefon) Then mContactperson.PhoneNumbers(PhoneNumberKey.BusinessPhone) = company.Telefon
If Not String.IsNullOrEmpty(company.Telefon) Then mContactperson.PhoneNumbers(PhoneNumberKey.BusinessFax) = company.Telefax

Dim PHAdress As New PhysicalAddressEntry
If Not String.IsNullOrEmpty(company.Adresse.Ort) Then PHAdress.City = company.Adresse.Ort
If Not String.IsNullOrEmpty(company.Adresse.Staat) Then PHAdress.State = company.Adresse.Staat
If Not String.IsNullOrEmpty(company.Adresse.Plz) Then PHAdress.PostalCode = company.Adresse.Plz

mContactperson.PhysicalAddresses.Item(PhysicalAddressKey.Business) = PHAdress

Dim PrivatePHAddress As New PhysicalAddressEntry()
mContactperson.PhysicalAddresses.Item(PhysicalAddressKey.Home).Street = ap.Adresse.Straße
mContactperson.PhysicalAddresses.Item(PhysicalAddressKey.Home).City = ap.Adresse.Ort
mContactperson.PhysicalAddresses.Item(PhysicalAddressKey.Home).PostalCode = ap.Adresse.Plz
mContactperson.PhysicalAddresses.Item(PhysicalAddressKey.Home).State = ap.Adresse.Staat


Update抛出异常

所以看来编辑多个物理地址会导致问题。但是让我感到困惑的是,当我们在编辑两个物理地址之间调用Update(...)时,我也会遇到异常。这是更新联系人的错误方法吗?

Update throws the exception

So it seems editing more than one physical adress causes the problem. But what makes me real confusing is that I also get the exception when we call Update( ... ) between editing the two physical adresses. Is this the wrong way to update a contact?

推荐答案



< EWS托管API 1.0 SDK(2009年11月)中的strong>更新联系人主题包含一个代码示例,向您展示如何更新联系人的地址字段:http://msdn.microsoft.com/en-us/library/ee693004.aspx 。请阅读该主题并将此帖标记为"答案"。如果它解决了你的问题。

问候,

Hi,

The Updating Contacts topic in the the EWS Managed API 1.0 SDK (November 2009) contains a code example that shows you how to update a contact's address fields:  http://msdn.microsoft.com/en-us/library/ee693004.aspx.  Please read that topic and mark this post as the "Answer" if it resolves your issue.

Regards,
Kim


这篇关于Contact.Update(...)EWS托管API的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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