Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

[Exchange-Online][EWS] - Getting unexpected "has invalid child element 'QueryString'" error.

$
0
0
Problem:

I'm trying to use EWS (not the Managed API) to send a FindItem query to Exchange Online. If I don't include a QueryString element, then I can retrieve all of the items in the designated folder, up to the MaxEntriesReturned attribute of the IndexedPageItemView element. 

The query I'm sending is:
<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:t='http://schemas.microsoft.com/exchange/services/2006/types' xmlns:m='http://schemas.microsoft.com/exchange/services/2006/messages' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>  <soap:Body>    <m:FindItem Traversal='Shallow'>      <m:ItemShape>        <t:BaseShape>AllProperties</t:BaseShape>        <t:AdditionalProperties>          <t:FieldURI FieldURI='item:Subject' />        </t:AdditionalProperties>      </m:ItemShape>      <m:IndexedPageItemView MaxEntriesReturned='1000' Offset='0' BasePoint='Beginning'/>      <m:ParentFolderIds>        <t:DistinguishedFolderId Id='inbox'/>      </m:ParentFolderIds>      <m:QueryString>subject:Office</m:QueryString>    </m:FindItem>  </soap:Body></soap:Envelope>
Based off of the example here: https://msdn.microsoft.com/EN-US/library/ee693615(v=exchg.150).aspx

When I POST this request to Exchange Online (https://outlook.office365.com/EWS/Exchange.asmx), I get the following response:

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">  <s:Body>    <s:Fault>      <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation</faultcode>      <faultstring xml:lang="en-US">The request failed schema validation: The element 'FindItem' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages' has invalid child element 'QueryString' in namespace
 'http://schemas.microsoft.com/exchange/services/2006/messages'.</faultstring>      <detail>        <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode>        <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.</e:Message>        <t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">          <t:LineNumber>1</t:LineNumber>          <t:LinePosition>757</t:LinePosition>          <t:Violation>The element 'FindItem' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages' has invalid child element 'QueryString' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'.</t:Violation>        </t:MessageXml>      </detail>    </s:Fault>  </s:Body></s:Envelope>
As I said, if I remove the QueryString element from the request, everything works as expected. I tried changing the order of the elements in the request, but wherever I place the QueryString (other than last) I get a response indicating that the server is expecting a different element next.

The QueryString element clearly exists in the schema here: (you'll be asked to login using MS credentials if you aren't already logged in) https://outlook.office365.com/EWS/messages.xsd and the order of the elements matches the options here: https://msdn.microsoft.com/EN-US/library/aa566370(v=exchg.150).aspx

Is this a bug in the EWS API or can I do something differently in my request?

Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>