OfficeDev / ews-managed-api

Other
585 stars 322 forks source link

EWS FindItem returns same ItemID several times on some conditions #267

Open SergioGalas opened 3 years ago

SergioGalas commented 3 years ago

Issue description

EWS FindItem request returns as much ItemID entries for single item(e.g. email) as much categories item has.

Date of first found occurence: 2nd June 2021,12:57:41 UTC

Affected servers: 15.20.4219.9

Sample request&response:

<Trace Tag="EwsRequest" Tid="86" Time="2021-06-02 12:57:41Z" Version="0.0.0.0">
  <?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://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
      <t:RequestServerVersion Version="Exchange2010_SP2" />
      <t:ExchangeImpersonation>
        <t:ConnectingSID>
          <t:SmtpAddress>***@***.***</t:SmtpAddress>
        </t:ConnectingSID>
      </t:ExchangeImpersonation>
    </soap:Header>
    <soap:Body>
      <m:FindItem Traversal="Shallow">
        <m:ItemShape>
          <t:BaseShape>IdOnly</t:BaseShape>
          <t:AdditionalProperties>
            <t:FieldURI FieldURI="item:Categories" />
            <t:FieldURI FieldURI="calendar:IsMeeting" />
            <t:ExtendedFieldURI DistinguishedPropertySetId="Meeting" PropertyId="3" PropertyType="Binary" />
          </t:AdditionalProperties>
        </m:ItemShape>
        <m:IndexedPageItemView MaxEntriesReturned="80" Offset="0" BasePoint="Beginning" />
        <m:Restriction>
          <t:IsEqualTo>
            <t:FieldURI FieldURI="item:Categories" />
            <t:FieldURIOrConstant>
              <t:Constant Value="Sync Error" />
            </t:FieldURIOrConstant>
          </t:IsEqualTo>
        </m:Restriction>
        <m:ParentFolderIds>
          <t:FolderId Id="AQMkADM0ZmYAMWQ3ZC1iMmUyLTRlZGYtODU5Zi1kYWVkNTgzNTJhMzYALgAAAz+58p4b0oJKgE8y9XjnxVsBAClZh5GvrjBIrYn8x+/NxDgAAAIBDQAAAA==" ChangeKey="AgAAABYAAABzfwe2FXarS7WY9hJ8c9hAAAGlAtXE" />
        </m:ParentFolderIds>
      </m:FindItem>
    </soap:Body>
  </soap:Envelope>
</Trace>

<Trace Tag="EwsResponseHttpHeaders" Tid="86" Time="2021-06-02 12:57:41Z">
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Encoding: gzip
Vary: Accept-Encoding
request-id: 39138611-170e-4006-bb26-615b5f223e9b
client-request-id: c49e35c1-4525-407e-a380-26e73f1d6865
X-CalculatedBETarget: CH2PR13MB4426.namprd13.prod.outlook.com
X-BackEndHttpStatus: 200
X-RUM-Validated: 1
x-EwsHandler: FindItem
X-BeSku: WCS6
X-DiagInfo: CH2PR13MB4426
X-BEServer: CH2PR13MB4426
X-Proxy-RoutingCorrectness: 1
X-Proxy-BackendServerStatus: 200
X-FEServer: CH2PR15CA0026
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Date: Wed, 02 Jun 2021 12:57:41 GMT
Set-Cookie: exchangecookie=c51512941faa4e27b2812a1ff145c2e7; path=/; secure
Server: Microsoft-IIS/10.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET

</Trace>

<Trace Tag="EwsResponse" Tid="86" Time="2021-06-02 12:57:41Z" Version="0.0.0.0">
  <?xml version="1.0" encoding="utf-8"?>
  <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
      <h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="4219" MinorBuildNumber="9" Version="V2018_01_08" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
    </s:Header>
    <s:Body>
      <m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
        <m:ResponseMessages>
          <m:FindItemResponseMessage ResponseClass="Success">
            <m:ResponseCode>NoError</m:ResponseCode>
            <m:RootFolder IndexedPagingOffset="4" TotalItemsInView="4" IncludesLastItemInRange="true">
              <t:Items>
                <t:CalendarItem>
                  <t:ItemId Id="AAMkADM0ZmYxZDdkLWIyZTItNGVkZi04NTlmLWRhZWQ1ODM1MmEzNgBGAAAAAAA/ufKeG9KCSoBPMvV458VbBwApWYeRr64wSK2J/MfvzcQ4AAAAAAENAABzfwe2FXarS7WY9hJ8c9hAAAC0A/27AAA=" ChangeKey="DwAAABYAAABzfwe2FXarS7WY9hJ8c9hAAAGE1dch" />
                  <t:Categories>
                    <t:String>Salesforce</t:String>
                  </t:Categories>
                  <t:ExtendedProperty>
                    <t:ExtendedFieldURI DistinguishedPropertySetId="Meeting" PropertyId="3" PropertyType="Binary" />
                    <t:Value>BAAAAIIA4AB0xbcQGoLgCAAAAAAwl1T4ETTWAQAAAAAAAAAAEAAAAFu3fN9v6+JOqUdHOJvN3z4=</t:Value>
                  </t:ExtendedProperty>
                  <t:IsMeeting>true</t:IsMeeting>
                </t:CalendarItem>
                <t:CalendarItem>
                  <t:ItemId Id="AAMkADM0ZmYxZDdkLWIyZTItNGVkZi04NTlmLWRhZWQ1ODM1MmEzNgBGAAAAAAA/ufKeG9KCSoBPMvV458VbBwApWYeRr64wSK2J/MfvzcQ4AAAAAAENAABzfwe2FXarS7WY9hJ8c9hAAAC0A/27AAA=" ChangeKey="DwAAABYAAABzfwe2FXarS7WY9hJ8c9hAAAGE1dch" />
                  <t:Categories>
                    <t:String>Saved to Salesforce</t:String>
                  </t:Categories>
                  <t:ExtendedProperty>
                    <t:ExtendedFieldURI DistinguishedPropertySetId="Meeting" PropertyId="3" PropertyType="Binary" />
                    <t:Value>BAAAAIIA4AB0xbcQGoLgCAAAAAAwl1T4ETTWAQAAAAAAAAAAEAAAAFu3fN9v6+JOqUdHOJvN3z4=</t:Value>
                  </t:ExtendedProperty>
                  <t:IsMeeting>true</t:IsMeeting>
                </t:CalendarItem>
                <t:CalendarItem>
                  <t:ItemId Id="AAMkADM0ZmYxZDdkLWIyZTItNGVkZi04NTlmLWRhZWQ1ODM1MmEzNgBGAAAAAAA/ufKeG9KCSoBPMvV458VbBwApWYeRr64wSK2J/MfvzcQ4AAAAAAENAABzfwe2FXarS7WY9hJ8c9hAAAC0A/27AAA=" ChangeKey="DwAAABYAAABzfwe2FXarS7WY9hJ8c9hAAAGE1dch" />
                  <t:Categories>
                    <t:String>Status: Salesforce meeting wasn't added to the Calendar. awaiting for Organizer to synchronize it.</t:String>
                  </t:Categories>
                  <t:ExtendedProperty>
                    <t:ExtendedFieldURI DistinguishedPropertySetId="Meeting" PropertyId="3" PropertyType="Binary" />
                    <t:Value>BAAAAIIA4AB0xbcQGoLgCAAAAAAwl1T4ETTWAQAAAAAAAAAAEAAAAFu3fN9v6+JOqUdHOJvN3z4=</t:Value>
                  </t:ExtendedProperty>
                  <t:IsMeeting>true</t:IsMeeting>
                </t:CalendarItem>
                <t:CalendarItem>
                  <t:ItemId Id="AAMkADM0ZmYxZDdkLWIyZTItNGVkZi04NTlmLWRhZWQ1ODM1MmEzNgBGAAAAAAA/ufKeG9KCSoBPMvV458VbBwApWYeRr64wSK2J/MfvzcQ4AAAAAAENAABzfwe2FXarS7WY9hJ8c9hAAAC0A/27AAA=" ChangeKey="DwAAABYAAABzfwe2FXarS7WY9hJ8c9hAAAGE1dch" />
                  <t:Categories>
                    <t:String>Sync Error</t:String>
                  </t:Categories>
                  <t:ExtendedProperty>
                    <t:ExtendedFieldURI DistinguishedPropertySetId="Meeting" PropertyId="3" PropertyType="Binary" />
                    <t:Value>BAAAAIIA4AB0xbcQGoLgCAAAAAAwl1T4ETTWAQAAAAAAAAAAEAAAAFu3fN9v6+JOqUdHOJvN3z4=</t:Value>
                  </t:ExtendedProperty>
                  <t:IsMeeting>true</t:IsMeeting>
                </t:CalendarItem>
              </t:Items>
            </m:RootFolder>
          </m:FindItemResponseMessage>
        </m:ResponseMessages>
      </m:FindItemResponse>
    </s:Body>
  </s:Envelope>
</Trace>

As you may see, ItemID is returned 4 times in single response when it was expected to be returned only once.

Preliminary investigation

Issue started to manifest itself on June 2 without any changes on application side, so update or change to Office 365 Exchange Online is a suspect.

Scope

Office 365 only. Exchange 2012-2016 doesn't have this behavior. Office 365: Only part of the customers are affected, while other part of customers are working OK. Possibly because of staged update of Office 365 instances

Issue definitely seen on Office 365 Exchange version: 15.20.4219.9 Issue doesn't seem to reproduce itself on: 15.20.4195.17

Is there any known fix/workaround to the issue?