2017-04-12 1 views
0

J'essaie de trouver des articles dans la boîte de réception avec ItemClass = IPM.Noteerreur de validation lors de l'utilisation du schéma Restriction dans l'EWS FindItem demande

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/"> 
    <soap:Header> 
     <t:RequestServerVersion Version="Exchange2010_SP2"></t:RequestServerVersion> 
    </soap:Header> 

    <soap:Body> 
     <FindItem Traversal="Shallow" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> 
      <ItemShape> 
       <t:BaseShape xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">IdOnly</t:BaseShape> 
       <t:AdditionalProperties xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
        <t:FieldURI FieldURI="item:ItemClass"></t:FieldURI> 
       </t:AdditionalProperties> 
      </ItemShape> 

      <IndexedPageItemView MaxEntriesReturned="50" Offset="0" BasePoint="Beginning"></IndexedPageItemView> 

      <Restriction> 
       <IsEqualTo> 
        <FieldURI FieldURI="item:ItemClass"></FieldURI> 
        <FieldURIOrConstant> 
         <Constant Value="IPM.Note"></Constant> 
        </FieldURIOrConstant> 
       </IsEqualTo> 
      </Restriction> 

      <ParentFolderIds> 
       <t:DistinguishedFolderId Id="inbox" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"></t:DistinguishedFolderId> 
      </ParentFolderIds> 

     </FindItem> 
    </soap:Body> 
</soap:Envelope> 

dans cette SchemaValidationError résultant

a:ErrorSchemaValidation: The request failed schema validation: The element 'Restriction' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages' has invalid child element 'IsEqualTo' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'. List of possible elements expected: 'SearchExpression' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'. [undefined] Error: a:ErrorSchemaValidation: The request failed schema validation: The element 'Restriction' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages' has invalid child element 'IsEqualTo' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'. List of possible elements expected: 'SearchExpression' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'. 

À ma understaning, SearchExpression is an abstract type that can be replaced with IsEqualTo, entre autres types.

Qu'est-ce qui me manque ici?

Répondre

0

Certains de ces éléments sont dans l'espace de noms "types de sorte qu'ils ont besoin le préfixe t:

 <Restriction> 
      <t:IsEqualTo> 
       <t:FieldURI FieldURI="item:ItemClass"></t:FieldURI> 
       <t:FieldURIOrConstant> 
        <t:Constant Value="IPM.Note"></t:Constant> 
       </t:FieldURIOrConstant> 
      </t:IsEqualTo> 
     </Restriction>