OfficeDev / ews-managed-api

Other
584 stars 318 forks source link

Unable to Update Contact Phone Numbers (Need XML) #160

Closed brianarpie closed 6 years ago

brianarpie commented 6 years ago

I am writing code that generates XML and interfaces with the EWS SOAP API directly. I have figured out how to update all of my desired properties except for one, phone numbers.

Since the XML for this operation is poorly documented my last resort is to ask for your help to find out what is the correct shape of the XML to update phone numbers.

I followed the pattern used for updating EmailAddresses (since they are both indexed fields). Here is a sample chunk of my XML Request:

<t:SetItemField>
  <t:IndexedFieldURI FieldURI="contacts:PhoneNumber" FieldIndex="BusinessPhone"/>
    <Contact xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
    <PhoneNumbers>
      <Entry key="BusinessPhone">888-777-6666</Entry>
    </PhoneNumbers>
  </Contact>
</t:SetItemField>

And this is the error message I receive back from Exchange:

An internal server error occurred. The operation failed., Key 'PhoneNumbers' not found for type 'Microsoft.Exchange.Services.Core.Types.ContactItemType'

To anyone who is using this library, could you perform this operation and trace the XML output so I can see how it's done correctly ?

Any other information leading to a solution is much appreciated!

Thank you

brianarpie commented 6 years ago

It turns out the attribute "key" is case sensitive and needs to be capitalized...

<Entry Key="BusinessPhone">888-777-6666</Entry>