Exchange Server TechCenter > Exchange Server Forums > Development > [EWS/C#] Problems updating the 'EmailAddressKey.EmailAddress1' property
Ask a questionAsk a question
 

Proposed Answer[EWS/C#] Problems updating the 'EmailAddressKey.EmailAddress1' property

  • Wednesday, November 04, 2009 1:29 PMCalumJR Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    I have a problem which I just cannot seem to get to the bottom of and I really would appreciate any help on the matter. Thank you in advance :)

    The version of Exchange Server I am targetting is Exchange Server 2007, Service Pack 1.

    Outline
    I have developed a Windows service which retrieves the contacts from a SharePoints list, compares them with the respective folder of contacts in Exchange Server and updates the contacts on both lists using both SharePoint Web Services and Exchange Web Services. I link the contacts by the ID of the contact in the SharePoint list (this ID is added as an extended property to the Exchange contact in order to ensure fine linking). This process all seems to work perfectly and is complete, minus any more bugs which may appear during the testing; however, I have come accross a fairly major problem which I can reproduce, described below.

    Problem
    I seem to be having some problems updating the EmailAddress1 property of an EWS Contact object. With the code below, a 'ServiceResponseException' is caught, after the 'Update' method, expressing "The specified object was not found in the store." However, that field of the contact is still actually updated in the Exchange Store. It does not always update in Outlook (specifically if the 'Email' field is selected, or has previously been selected and then removed, for the current view) but it always updates the contact in the Exchange Store; I know this because when I next read the same contact in, stepping through the program, I check the field in the Contact object and it contains the updated value, even though this updated field doesn't always display the new value in Outlook.
                            if (objExchangeContact.EmailAddresses[EmailAddressKey.EmailAddress1] != objContact.GetField(Contact.Field.EmailAddress))
                                objExchangeContact.EmailAddresses[EmailAddressKey.EmailAddress1] = objContact.GetField(Contact.Field.EmailAddress);                       
    
                            objExchangeContact.Update(ConflictResolutionMode.AlwaysOverwrite);


    XML returned just before the 'Update' function is called, after setting 'TraceEnabled' to true
    If it helps, this is the XML output to the console:
    <EwsLogEntry EntryKind="EwsRequest" ThreadId="10" Timestamp="04/11/2009 13:25:4
    ">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m=
    http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://s
    hemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xm
    soap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2007_SP1" />
        </soap:Header>
        <soap:Body>
          <m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOve
    write">
            <m:ItemChanges>
              <t:ItemChange>
                <t:ItemId Id="AAMkAGJiY2IxNjExLWQxZWYtNGM4MS1hZGUzLThhMzE1Y2RjMmE3Y
    BGAAAAAABNsKRXPIyVTZk7tVpIIdMbBwDVidYH0/koRoe6JmTCPIvuABX8wAAMAAAsX9aoRrTdT4QvF
    zAyNmyABYU+9l9AAA=" ChangeKey="EQAAABYAAAAsX9aoRrTdT4QvFrzAyNmyABYVAC97" />
                <t:Updates>
                  <t:SetItemField>
                    <t:FieldURI FieldURI="contacts:CompanyName" />
                    <t:Contact>
                      <t:CompanyName>
                      </t:CompanyName>
                    </t:Contact>
                  </t:SetItemField>
                  <t:SetItemField>
                    <t:FieldURI FieldURI="contacts:JobTitle" />
                    <t:Contact>
                      <t:JobTitle>
                      </t:JobTitle>
                    </t:Contact>
                  </t:SetItemField>
                  <t:SetItemField>
                    <t:IndexedFieldURI FieldURI="contacts:EmailAddress" FieldIndex=
    EmailAddress1" />
                    <t:Contact>
                      <t:EmailAddresses>
                        <t:Entry Key="EmailAddress1">tghhhrt@grgwr.com</t:Entry>
                      </t:EmailAddresses>
                    </t:Contact>
                  </t:SetItemField>
                </t:Updates>
              </t:ItemChange>
            </m:ItemChanges>
          </m:UpdateItem>
        </soap:Body>
      </soap:Envelope>
    </EwsLogEntry>
    <EwsLogEntry EntryKind="EwsResponseHttpHeaders" ThreadId="10" Timestamp="04/11/
    009 13:25:43">200 OK
    Content-Encoding: gzip
    Vary: Accept-Encoding
    Content-Length: 550
    Cache-Control: private, max-age=0
    Content-Type: text/xml; charset=utf-8
    Date: Wed, 04 Nov 2009 13:25:43 GMT
    Server: Microsoft-IIS/7.0
    X-AspNet-Version: 2.0.50727
    X-Powered-By: ASP.NET
    
    </EwsLogEntry>
    <EwsLogEntry EntryKind="EwsResponse" ThreadId="10" Timestamp="04/11/2009 13:25:
    3">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:x
    i="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001
    XMLSchema">
        <soap:Header>
          <t:ServerVersionInfo MajorVersion="8" MinorVersion="1" MajorBuildNumber="
    40" MinorBuildNumber="0" Version="Exchange2007_SP1" xmlns:t="http://schemas.mic
    osoft.com/exchange/services/2006/types" />
        </soap:Header>
        <soap:Body>
          <m:UpdateItemResponse xmlns:t="http://schemas.microsoft.com/exchange/serv
    ces/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/me
    sages">
            <m:ResponseMessages>
              <m:UpdateItemResponseMessage ResponseClass="Error">
                <m:MessageText>The specified object was not found in the store.</m:
    essageText>
                <m:ResponseCode>ErrorItemNotFound</m:ResponseCode>
                <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
                <m:Items />
              </m:UpdateItemResponseMessage>
            </m:ResponseMessages>
          </m:UpdateItemResponse>
        </soap:Body>
      </soap:Envelope>
    </EwsLogEntry>
    


    Any help really would be much appreciated. I believe this may be a bug of some form within the API or Exchange Server, however it may not be.

All Replies

  • Thursday, November 05, 2009 5:07 PMDavid Claux - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This doesn't look like it's related to EmailAddress1. This error indicates that the item that is being updated doesn't exist in Exchange. Are you sure that the item has not been deleted before the Update call? A good way to confirm would be to Bind to that item, and see if it works.
    David Claux | Program Manager - Exchange Web Services
  • Thursday, November 05, 2009 9:04 PMCalumJR Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you for the suggestion David. When I return to work tomorrow morning, I will try to Bind to the item to see if that works, however, I am quite positive the item still exists because even though the 'Update' function catches that exception, the email address of the item (in the Exchange Store) is actually updated and I am able to read that same item in (with the updated email address) when my program loops again. After thinking about that, could it still be possible that the item has been deleted (even though I am able to read it in when the program loops again)? Nothing in my code deletes the item even though I do understand what the exception is expressing. Any more advise really would be appreciated and thank you for your help so far.
  • Friday, November 06, 2009 1:41 PMCalumJR Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code

    Now I am back at work, I tried binding to the contact. I created a new EWS Contact object from the original Contact object, calling the 'Bind' method. I then assigned the email address to this new object and called the 'Update' method as usual:

                            Microsoft.Exchange.WebServices.Data.Contact objIsContactThere = Microsoft.Exchange.WebServices.Data.Contact.Bind(mobjService, objExchangeContact.Id);
    
                                objIsContactThere.EmailAddresses[EmailAddressKey.EmailAddress1].Address = objContact.GetField(Contact.Field.EmailAddress);
    
                            objIsContactThere.Update(ConflictResolutionMode.AlwaysOverwrite);
    
    After calling the 'Bind' method, the new 'objIsContactThere' object is assigned all of the properties of the 'objExchangeContact' object perfectly - I have stepped through to check this. However, after calling the 'Update' method using the 'objIsContactThere' object, I receive the same exception message "The specified object was not found in the store." I would expect this seeing as I have just created the new object on the spot and it doesn't belong in anybody's mailbox, but the fact this new object gains all of the properties of the contact to be updated, after using the 'Bind' method, leads me to believe the original contact is still in the store and has not been deleted.

    Is this what you meant by bind or did you mean something else?

    As I say, what's odd is that even though I receive the exception, the EmailAddress field of that contact in the Exchange Store appears to still be updated because when my program loops and I read that same contact in again, the EmailAddress1 key contains the new value. It still doesn't display in Outlook though.

    Any more advise would be much appreciated as this is now the last important known issue with my program. Thank you once again for your help so far.
  • Friday, November 06, 2009 4:54 PMDavid Claux - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed AnswerHas Code

    I think the error you are getting is not "The specified object was not found in the store", but "The given key was not present in the dictionary." which is very different.

    You cannot just assign Address, you have to do either of the following:

    // Either explicitly instantiate an EmailAddress object:
    contact.EmailAddresses[EmailAddressKey.EmailAddress1] = new EmailAddress();
    contact.EmailAddresses[EmailAddressKey.EmailAddress1].Address = "user@contoso.com";
    
    // Or do this. EmailAddress defines an implicit conversion operator from string,
    // so the below does exactly the same as the above:
    contact.EmailAddresses[EmailAddressKey.EmailAddress1] = "user@contoso.com";
    
    

    David Claux | Program Manager - Exchange Web Services
  • Friday, November 06, 2009 4:57 PMDavid Claux - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Note that the above does not answer why you indeed get the "The specified object was not found in the store." error in your original message.

    Please retry the code that Binds then Updates with the fix I suggest. Then if you get an error make sure it is indeed "The specified object was not found in the store." If you do not get an error, then I'd say there is probably a bug somewhere in your code.
    David Claux | Program Manager - Exchange Web Services
  • Tuesday, November 10, 2009 10:23 AMCalumJR Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Thank you David. I have tried what you said (both ways of updating the email address property) but unfortunately the error message I am getting is still "The specified object was not found in the store." I am 100% positive this is the message I am receiving. I had previously received the other message you suggested, but to correct that I added code to check if the Contact object contains the email address first (seeing as during this function a contact may or may not already include an EmailAddress property).

    I had tried both of the ways you suggested but my code now stands as shown below (seeing as this seems the most logical to me - update the email field if the contact already contains it, but create a new one if not). I instantiated two new Contact objects by binding to the current contact - one before the email address field is updated (as shown below) and one after all of the other properties have been assigned, before the 'Update' function; both new Contact objects were assigned all of the properties of the original contact and seemed to be instantiated perfectly fine. Again, I have stepped through and checked the EmailAddress1 key of all of these Contact objects and all show the updated value when they should, even when my program loops again and the same contact is read in. What's even more odd is that sometimes, when the 'Email' field is not visible in the View in Outlook, this will be updated in Outlook; other times, it won't. The following is a snippet of my code as described:
                            mobjService.TraceEnabled = true;
    
                            Microsoft.Exchange.WebServices.Data.Contact objTest = Microsoft.Exchange.WebServices.Data.Contact.Bind(mobjService, objExchangeContact.Id);
    
                            if ((objExchangeContact.EmailAddresses.Contains(EmailAddressKey.EmailAddress1) && objExchangeContact.EmailAddresses[EmailAddressKey.EmailAddress1].Address != objContact.GetField(Contact.Field.EmailAddress)))
                            {
                                 objExchangeContact.EmailAddresses[EmailAddressKey.EmailAddress1] = objContact.GetField(Contact.Field.EmailAddress);
                            }
                            else if ((!objExchangeContact.EmailAddresses.Contains(EmailAddressKey.EmailAddress1) && objContact.GetField(Contact.Field.EmailAddress).Length > 0))
                            {
                                objExchangeContact.EmailAddresses[EmailAddressKey.EmailAddress1] = new EmailAddress();
                                objExchangeContact.EmailAddresses[EmailAddressKey.EmailAddress1].Address = objContact.GetField(Contact.Field.EmailAddress);
                            }
    
    

    I thought it might be best to show you all of the XML output after that code has been executed (including the rest of the code which assigns properties and the 'Update' function). The first main log entry was output when the first Bind was executed, the second main log entry after the second bind (once the email address and other properties were assigned) and the third main log entry after the 'Update' function was called. The original email address of the contact was test@live.co.uk and the assigned value (which was actually updated in Outlook this time, despite me still receiving the exception message) was rita@worknowemail.com:
    <EwsLogEntry EntryKind="EwsRequest" ThreadId="11" Timestamp="10/11/2009 10:12:53
    ">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="
    http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://sc
    hemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xml
    soap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2007_SP1" />
          <t:TimeZoneContext>
            <t:TimeZoneDefinition Id="GMT Standard Time" />
          </t:TimeZoneContext>
        </soap:Header>
        <soap:Body>
          <m:GetItem>
            <m:ItemShape>
              <t:BaseShape>AllProperties</t:BaseShape>
            </m:ItemShape>
            <m:ItemIds>
              <t:ItemId Id="AAMkADY4NWNjZmNhLWI4YmYtNGM3MS04YjVlLTkzNjU0NzU5NWI3MwBG
    AAAAAABqs2+QcYMoSJszQ/Pz27ZmBwAsX9aoRrTdT4QvFrzAyNmyABYA2qOiAAAsX9aoRrTdT4QvFrzA
    yNmyABYU+5r8AAA=" ChangeKey="EQAAABYAAAAsX9aoRrTdT4QvFrzAyNmyABYVAYwf" />
            </m:ItemIds>
          </m:GetItem>
        </soap:Body>
      </soap:Envelope>
    </EwsLogEntry>
    <EwsLogEntry EntryKind="EwsResponseHttpHeaders" ThreadId="11" Timestamp="10/11/2
    009 10:12:53">200 OK
    Content-Encoding: gzip
    Vary: Accept-Encoding
    Content-Length: 1335
    Cache-Control: private, max-age=0
    Content-Type: text/xml; charset=utf-8
    Date: Tue, 10 Nov 2009 10:12:53 GMT
    Server: Microsoft-IIS/7.0
    X-AspNet-Version: 2.0.50727
    X-Powered-By: ASP.NET
    
    </EwsLogEntry>
    <EwsLogEntry EntryKind="EwsResponse" ThreadId="11" Timestamp="10/11/2009 10:12:5
    3">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs
    i="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/
    XMLSchema">
        <soap:Header>
          <t:ServerVersionInfo MajorVersion="8" MinorVersion="1" MajorBuildNumber="3
    40" MinorBuildNumber="0" Version="Exchange2007_SP1" xmlns:t="http://schemas.micr
    osoft.com/exchange/services/2006/types" />
        </soap:Header>
        <soap:Body>
          <m:GetItemResponse xmlns:t="http://schemas.microsoft.com/exchange/services
    /2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messag
    es">
            <m:ResponseMessages>
              <m:GetItemResponseMessage ResponseClass="Success">
                <m:ResponseCode>NoError</m:ResponseCode>
                <m:Items>
                  <t:Contact>
                    <t:ItemId Id="AAMkADY4NWNjZmNhLWI4YmYtNGM3MS04YjVlLTkzNjU0NzU5NW
    I3MwBGAAAAAABqs2+QcYMoSJszQ/Pz27ZmBwAsX9aoRrTdT4QvFrzAyNmyABYA2qOiAAAsX9aoRrTdT4
    QvFrzAyNmyABYU+5r8AAA=" ChangeKey="EQAAABYAAAAsX9aoRrTdT4QvFrzAyNmyABYVAYwf" />
                    <t:ParentFolderId Id="AAMkADY4NWNjZmNhLWI4YmYtNGM3MS04YjVlLTkzNj
    U0NzU5NWI3MwAuAAAAAABqs2+QcYMoSJszQ/Pz27ZmAQAsX9aoRrTdT4QvFrzAyNmyABYA2qOiAAA="
    ChangeKey="AQAAAA==" />
                    <t:ItemClass>IPM.Contact</t:ItemClass>
                    <t:Sensitivity>Normal</t:Sensitivity>
                    <t:Body BodyType="HTML" />
                    <t:DateTimeReceived>2009-11-10T09:26:33Z</t:DateTimeReceived>
                    <t:Size>290</t:Size>
                    <t:Importance>Normal</t:Importance>
                    <t:IsSubmitted>false</t:IsSubmitted>
                    <t:IsDraft>true</t:IsDraft>
                    <t:IsFromMe>false</t:IsFromMe>
                    <t:IsResend>false</t:IsResend>
                    <t:IsUnmodified>false</t:IsUnmodified>
                    <t:DateTimeSent>2009-11-10T09:26:33Z</t:DateTimeSent>
                    <t:DateTimeCreated>2009-11-10T09:26:33Z</t:DateTimeCreated>
                    <t:DisplayCc />
                    <t:DisplayTo />
                    <t:HasAttachments>false</t:HasAttachments>
                    <t:Culture>en-US</t:Culture>
                    <t:EffectiveRights>
                      <t:CreateAssociated>false</t:CreateAssociated>
                      <t:CreateContents>false</t:CreateContents>
                      <t:CreateHierarchy>false</t:CreateHierarchy>
                      <t:Delete>true</t:Delete>
                      <t:Modify>true</t:Modify>
                      <t:Read>true</t:Read>
                    </t:EffectiveRights>
                    <t:LastModifiedName>AIMS Server</t:LastModifiedName>
                    <t:LastModifiedTime>2009-11-10T10:10:19Z</t:LastModifiedTime>
                    <t:FileAs>Rita Fogliettaa</t:FileAs>
                    <t:FileAsMapping>None</t:FileAsMapping>
                    <t:DisplayName>Rita Fogliettaa</t:DisplayName>
                    <t:GivenName>Rita</t:GivenName>
                    <t:Initials>R.F.</t:Initials>
                    <t:CompleteName>
                      <t:FirstName>Rita</t:FirstName>
                      <t:LastName>Fogliettaa</t:LastName>
                      <t:Initials>R.F.</t:Initials>
                      <t:FullName>Rita Fogliettaa</t:FullName>
                    </t:CompleteName>
                    <t:CompanyName />
                    <t:EmailAddresses>
                      <t:Entry Key="EmailAddress1">test@live.co.uk</t:Entry>
                    </t:EmailAddresses>
                    <t:PhysicalAddresses>
                      <t:Entry Key="Business">
                        <t:Street />
                        <t:City />
                        <t:State />
                        <t:CountryOrRegion />
                        <t:PostalCode />
                      </t:Entry>
                    </t:PhysicalAddresses>
                    <t:PhoneNumbers>
                      <t:Entry Key="BusinessPhone" />
                      <t:Entry Key="HomePhone" />
                      <t:Entry Key="MobilePhone" />
                    </t:PhoneNumbers>
                    <t:BusinessHomePage />
                    <t:JobTitle />
                    <t:Surname>Fogliettaa</t:Surname>
                  </t:Contact>
                </m:Items>
              </m:GetItemResponseMessage>
            </m:ResponseMessages>
          </m:GetItemResponse>
        </soap:Body>
      </soap:Envelope>
    </EwsLogEntry>
    
    
    
    
    
    
    
    
    
    
    <EwsLogEntry EntryKind="EwsRequest" ThreadId="11" Timestamp="10/11/2009 10:14:00
    ">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="
    http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://sc
    hemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xml
    soap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2007_SP1" />
          <t:TimeZoneContext>
            <t:TimeZoneDefinition Id="GMT Standard Time" />
          </t:TimeZoneContext>
        </soap:Header>
        <soap:Body>
          <m:GetItem>
            <m:ItemShape>
              <t:BaseShape>AllProperties</t:BaseShape>
            </m:ItemShape>
            <m:ItemIds>
              <t:ItemId Id="AAMkADY4NWNjZmNhLWI4YmYtNGM3MS04YjVlLTkzNjU0NzU5NWI3MwBG
    AAAAAABqs2+QcYMoSJszQ/Pz27ZmBwAsX9aoRrTdT4QvFrzAyNmyABYA2qOiAAAsX9aoRrTdT4QvFrzA
    yNmyABYU+5r8AAA=" ChangeKey="EQAAABYAAAAsX9aoRrTdT4QvFrzAyNmyABYVAYwf" />
            </m:ItemIds>
          </m:GetItem>
        </soap:Body>
      </soap:Envelope>
    </EwsLogEntry>
    <EwsLogEntry EntryKind="EwsResponseHttpHeaders" ThreadId="11" Timestamp="10/11/2
    009 10:14:00">200 OK
    Content-Encoding: gzip
    Vary: Accept-Encoding
    Content-Length: 1335
    Cache-Control: private, max-age=0
    Content-Type: text/xml; charset=utf-8
    Date: Tue, 10 Nov 2009 10:14:00 GMT
    Server: Microsoft-IIS/7.0
    X-AspNet-Version: 2.0.50727
    X-Powered-By: ASP.NET
    
    </EwsLogEntry>
    <EwsLogEntry EntryKind="EwsResponse" ThreadId="11" Timestamp="10/11/2009 10:14:0
    0">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs
    i="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/
    XMLSchema">
        <soap:Header>
          <t:ServerVersionInfo MajorVersion="8" MinorVersion="1" MajorBuildNumber="3
    40" MinorBuildNumber="0" Version="Exchange2007_SP1" xmlns:t="http://schemas.micr
    osoft.com/exchange/services/2006/types" />
        </soap:Header>
        <soap:Body>
          <m:GetItemResponse xmlns:t="http://schemas.microsoft.com/exchange/services
    /2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messag
    es">
            <m:ResponseMessages>
              <m:GetItemResponseMessage ResponseClass="Success">
                <m:ResponseCode>NoError</m:ResponseCode>
                <m:Items>
                  <t:Contact>
                    <t:ItemId Id="AAMkADY4NWNjZmNhLWI4YmYtNGM3MS04YjVlLTkzNjU0NzU5NW
    I3MwBGAAAAAABqs2+QcYMoSJszQ/Pz27ZmBwAsX9aoRrTdT4QvFrzAyNmyABYA2qOiAAAsX9aoRrTdT4
    QvFrzAyNmyABYU+5r8AAA=" ChangeKey="EQAAABYAAAAsX9aoRrTdT4QvFrzAyNmyABYVAYwf" />
                    <t:ParentFolderId Id="AAMkADY4NWNjZmNhLWI4YmYtNGM3MS04YjVlLTkzNj
    U0NzU5NWI3MwAuAAAAAABqs2+QcYMoSJszQ/Pz27ZmAQAsX9aoRrTdT4QvFrzAyNmyABYA2qOiAAA="
    ChangeKey="AQAAAA==" />
                    <t:ItemClass>IPM.Contact</t:ItemClass>
                    <t:Sensitivity>Normal</t:Sensitivity>
                    <t:Body BodyType="HTML" />
                    <t:DateTimeReceived>2009-11-10T09:26:33Z</t:DateTimeReceived>
                    <t:Size>290</t:Size>
                    <t:Importance>Normal</t:Importance>
                    <t:IsSubmitted>false</t:IsSubmitted>
                    <t:IsDraft>true</t:IsDraft>
                    <t:IsFromMe>false</t:IsFromMe>
                    <t:IsResend>false</t:IsResend>
                    <t:IsUnmodified>false</t:IsUnmodified>
                    <t:DateTimeSent>2009-11-10T09:26:33Z</t:DateTimeSent>
                    <t:DateTimeCreated>2009-11-10T09:26:33Z</t:DateTimeCreated>
                    <t:DisplayCc />
                    <t:DisplayTo />
                    <t:HasAttachments>false</t:HasAttachments>
                    <t:Culture>en-US</t:Culture>
                    <t:EffectiveRights>
                      <t:CreateAssociated>false</t:CreateAssociated>
                      <t:CreateContents>false</t:CreateContents>
                      <t:CreateHierarchy>false</t:CreateHierarchy>
                      <t:Delete>true</t:Delete>
                      <t:Modify>true</t:Modify>
                      <t:Read>true</t:Read>
                    </t:EffectiveRights>
                    <t:LastModifiedName>AIMS Server</t:LastModifiedName>
                    <t:LastModifiedTime>2009-11-10T10:10:19Z</t:LastModifiedTime>
                    <t:FileAs>Rita Fogliettaa</t:FileAs>
                    <t:FileAsMapping>None</t:FileAsMapping>
                    <t:DisplayName>Rita Fogliettaa</t:DisplayName>
                    <t:GivenName>Rita</t:GivenName>
                    <t:Initials>R.F.</t:Initials>
                    <t:CompleteName>
                      <t:FirstName>Rita</t:FirstName>
                      <t:LastName>Fogliettaa</t:LastName>
                      <t:Initials>R.F.</t:Initials>
                      <t:FullName>Rita Fogliettaa</t:FullName>
                    </t:CompleteName>
                    <t:CompanyName />
                    <t:EmailAddresses>
                      <t:Entry Key="EmailAddress1">test@live.co.uk</t:Entry>
                    </t:EmailAddresses>
                    <t:PhysicalAddresses>
                      <t:Entry Key="Business">
                        <t:Street />
                        <t:City />
                        <t:State />
                        <t:CountryOrRegion />
                        <t:PostalCode />
                      </t:Entry>
                    </t:PhysicalAddresses>
                    <t:PhoneNumbers>
                      <t:Entry Key="BusinessPhone" />
                      <t:Entry Key="HomePhone" />
                      <t:Entry Key="MobilePhone" />
                    </t:PhoneNumbers>
                    <t:BusinessHomePage />
                    <t:JobTitle />
                    <t:Surname>Fogliettaa</t:Surname>
                  </t:Contact>
                </m:Items>
              </m:GetItemResponseMessage>
            </m:ResponseMessages>
          </m:GetItemResponse>
        </soap:Body>
      </soap:Envelope>
    </EwsLogEntry>
    
    
    
    
    
    
    
    
    
    
    
    <EwsLogEntry EntryKind="EwsRequest" ThreadId="11" Timestamp="10/11/2009 10:15:29
    ">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="
    http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://sc
    hemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xml
    soap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2007_SP1" />
          <t:TimeZoneContext>
            <t:TimeZoneDefinition Id="GMT Standard Time" />
          </t:TimeZoneContext>
        </soap:Header>
        <soap:Body>
          <m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOver
    write">
            <m:ItemChanges>
              <t:ItemChange>
                <t:ItemId Id="AAMkADY4NWNjZmNhLWI4YmYtNGM3MS04YjVlLTkzNjU0NzU5NWI3Mw
    BGAAAAAABqs2+QcYMoSJszQ/Pz27ZmBwAsX9aoRrTdT4QvFrzAyNmyABYA2qOiAAAsX9aoRrTdT4QvFr
    zAyNmyABYU+5r8AAA=" ChangeKey="EQAAABYAAAAsX9aoRrTdT4QvFrzAyNmyABYVAYwf" />
                <t:Updates>
                  <t:SetItemField>
                    <t:FieldURI FieldURI="contacts:CompanyName" />
                    <t:Contact>
                      <t:CompanyName>
                      </t:CompanyName>
                    </t:Contact>
                  </t:SetItemField>
                  <t:SetItemField>
                    <t:FieldURI FieldURI="contacts:JobTitle" />
                    <t:Contact>
                      <t:JobTitle>
                      </t:JobTitle>
                    </t:Contact>
                  </t:SetItemField>
                  <t:SetItemField>
                    <t:FieldURI FieldURI="contacts:BusinessHomePage" />
                    <t:Contact>
                      <t:BusinessHomePage>
                      </t:BusinessHomePage>
                    </t:Contact>
                  </t:SetItemField>
                  <t:SetItemField>
                    <t:IndexedFieldURI FieldURI="contacts:EmailAddress" FieldIndex="
    EmailAddress1" />
                    <t:Contact>
                      <t:EmailAddresses>
                        <t:Entry Key="EmailAddress1">rita@worknowemail.com</t:Entry>
    
                      </t:EmailAddresses>
                    </t:Contact>
                  </t:SetItemField>
                </t:Updates>
              </t:ItemChange>
            </m:ItemChanges>
          </m:UpdateItem>
        </soap:Body>
      </soap:Envelope>
    </EwsLogEntry>
    

    Any more help really would be very much appreciated. I cannot see anywhere in my code which deletes the contact or removes it from the store and no obvious bugs stick out to me. Everything else seems to work fine and even reading in the contact after my program loops again reads in the updated value.

    I could take screenshots of any of my code or provide more feedback if needed?

    Thank you,
    Calum.
  • Tuesday, November 10, 2009 3:55 PMDavid Claux - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    So you are saying that even though you are receiving an error, the contact is actually updated, and when you reload it it does have the updated property value?

    Something that can't hurt would be to upgrade to Exchange 2007 SP2 if you haven't done so already.


    David Claux | Program Manager - Exchange Web Services