EWS缺少必需的属性“遍历”

时间:2012-08-29 11:13:12

标签: exchangewebservices traversal

我在使用EWS( Exchange Webservice

时遇到问题

我发送了FindFolders

的请求
<?xml version="1.0"?>
<soap12:Envelope xmlns:soap12="http://schemas.xmlsoap.org/soap/envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:M="http://schemas.microsoft.com/exchange/services/2006/messages" soap12:encodingStyle="http://www.w3.org/2003/05/soap-encoding" xmlns:T="http://schemas.microsoft.com/exchange/services/2006/types">
 <soap12:Body>
  <M:FindFolder>
   <request SOAP-ENC:id="1" xsi:type="M:FindFolder" Traversal="Deep">
    <FolderShape xsi:nil="true"/>
    <IndexedPageFolderView SOAP-ENC:id="2" xsi:type="T:IndexedPageViewType" Offset="0" BasePoint="Beginning"/>
    <ParentFolderIds xsi:nil="true"/>
   </request>
   <Impersonation xsi:nil="true"/>
   <S2SAuth xsi:nil="true"/>
   <MailboxCulture xsi:type="xsd:string">de-DE</MailboxCulture>
   <RequestVersion SOAP-ENC:id="3" xsi:type="T:RequestServerVersion"   Version="Exchange2007_SP1"/>
  </M:FindFolder>
 </soap12:Body>
</soap12:Envelope>

并从服务器获取以下xml

    <?xml version="1.0"?>
    <soap11:Envelope xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
     <soap11:Header>
      <t:ServerVersionInfo MajorVersion="8" MinorVersion="3" MajorBuildNumber="245" MinorBuildNumber="0" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
     </soap11:Header>
     <soap11:Body>
      <soap11:Fault>
       <faultcode>soap11:Client</faultcode>
       <faultstring>The request failed schema validation: The required attribute 'Traversal' is missing.</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 required attribute 'Traversal' is missing.

        </e:Message>
        <e:Line xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">2
        </e:Line>
        <e:Position xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">446
        </e:Position>
       </detail>
      </soap11:Fault>
     </soap11:Body>
    </soap11:Envelope>

那么为什么服务器说Traversal丢失了?

我也用T:Traversal = Deep T测试了它:对于类型的命名空间

有人可以帮我解决这个问题吗?

2 个答案:

答案 0 :(得分:1)

FindFolder元素上的

Traversal is required。尝试从...更改它

<M:FindFolder> 
   <!-- ... -->

对此...

<M:FindFolder Traversal="Deep"> 
   <!-- ... -->

Traversal属性must adhere to the following XSD schema

<simpleType name="FolderQueryTraversalType">
   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
     <enumeration value="Shallow"/>
     <enumeration value="Deep"/>
     <enumeration value="SoftDeleted"/>
   </restriction>
 </simpleType>

答案 1 :(得分:1)

我试过跟随星座

<M:FindFolder M:Traversal="DEEP>
The request failed schema validation: The 'http://schemas.microsoft.com/exchange/services/2006/messages:Traversal' attribute is not declared.

<M:FindFolder T:Traversal="DEEP>
The request failed schema validation: The 'http://schemas.microsoft.com/exchange/services/2006/types:Traversal' attribute is not declared.


<M:FindFolder Traversal="DEEP">

The request failed schema validation: The 'Traversal' attribute is invalid - The value 'DEEP' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:FolderQueryTraversalType' - The Enumeration constraint failed.