2017-04-12 32 views
0

使用限制,當我試圖找到與itemClass時= IPM.Note的架構驗證錯誤在EWS的FindItem要求

<?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> 

在收件箱中的物品在此SchemaValidationError

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'. 

要我understaning得到的, SearchExpression is an abstract type that can be replaced with IsEqualTo,以及其他類型。

我在這裏錯過了什麼?

回答

0

一些這些元素都在「類型」命名空間,以便他們所需要的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>