-1

I was unable to execute a Soap Exhange request to update contacts:PersonalNotes .

I have not found documentation on msdn: https://msdn.microsoft.com/en-us/library/office/ee693002(v=exchg.80).aspx

this is my soap code:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2016" />
<t:TimeZoneContext>
<t:TimeZoneDefinition Id="Eastern Standard Time" />
</t:TimeZoneContext>
</soap:Header>
<soap:Body>
<m:UpdateItem MessageDisposition="SaveOnly" 
ConflictResolution="AlwaysOverwrite">
<m:ItemChanges>
<t:ItemChange>
<t:ItemId 
Id="AAMkAD...QAAAz9hI5AAA=" ChangeKey="EQAAAB...QAAAz9rdN" />
<t:Updates>

        <t:SetItemField>
        <t:FieldURI FieldURI="contacts:Notes" />
        <t:Contact>
            <t:Notes>TEST N</t:Notes>
        </t:Contact>
    </t:SetItemField>

</t:Updates>
</t:ItemChange>
</m:ItemChanges>
</m:UpdateItem>
</soap:Body>
</soap:Envelope>

this the error displayed:

enter image description here

What is the soap code to write to edit the Contact PersonalNotes ?

Sabri Mbarek
  • 31
  • 1
  • 12
  • Are you sure that the ItemId references a Contact? What if you do a GetItem, as done here [link](https://msdn.microsoft.com/en-us/library/office/aa563527(v=exchg.150).aspx) using the same Id and ChangeKey, what does it return? – Rogn Jan 16 '18 at 17:12

1 Answers1

0

The Notes field in a Contact is the Body Property of a Message so to update you need to update the body eg

  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
      <t:RequestServerVersion Version="Exchange2013_SP1" />
    </soap:Header>
    <soap:Body>
      <m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOverwrite">
        <m:ItemChanges>
          <t:ItemChange>
            <t:ItemId Id="AAMkADczN=" ChangeKey="EQAAABYAAAB1EEf9R" />
            <t:Updates>
              <t:SetItemField>
                <t:FieldURI FieldURI="item:Body" />
                <t:Contact>
                  <t:Body BodyType="Text">test text</t:Body>
                </t:Contact>
              </t:SetItemField>
            </t:Updates>
          </t:ItemChange>
        </m:ItemChanges>
      </m:UpdateItem>
    </soap:Body>
  </soap:Envelope>
Glen Scales
  • 20,495
  • 1
  • 20
  • 23