none
EWS - Using QueryString in FindItem Request with multiple ParentFolders RRS feed

  • Question

  • Hi,

    based on the example that can be found on the MSDN page "How to: Perform an AQS search by using EWS in Exchange". I am trying to request emails from the Exchange that contain a specific keyword in the subject. My XML looks like this

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope>
      <soap:Header>
        <t:RequestServerVersion Version="Exchange2013" />
      </soap:Header>
      <soap:Body>
        <m:FindItem Traversal="Shallow">
          <m:ItemShape>
            <t:BaseShape>IdOnly</t:BaseShape>
          </m:ItemShape>
          <m:IndexedPageItemView MaxEntriesReturned="10" Offset="0" BasePoint="Beginning" />
          <m:ParentFolderIds>
            <t:DistinguishedFolderId Id="inbox" />
          </m:ParentFolderIds>
          <m:QueryString>subject:"test"</m:QueryString>
        </m:FindItem>
      </soap:Body>
    </soap:Envelope>

    This code works well and as expected.

    However, if I add a second parent folder, e.g. "sentitems" , I only get a response for the first folder. No error or anything, the second folder seems to be ignored. However, if I remove the QueryString, I get a response for both folders (as expected). I tried this with Exchange 2010 and Exchange 2013. Did I miss a restriction that the QueryString can only be used on a single folder or am I using it incorrectly? Any help is appreciated.


    • Edited by frangge Thursday, April 27, 2017 8:26 AM
    Thursday, April 27, 2017 8:18 AM