2016-07-27 28 views
0

我試圖使用PullSubscriptionSubscrubeToAllFolders屬性上Microsoft Office Dev Center如記錄PullSubscription時:InternalServerError製作與SubscribeToAllFolders

<?xml version="1.0" encoding="UTF-8"?> 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
    <s:Header> 
     <t:RequestServerVersion Version="Exchange2013_SP1" /> 
    </s:Header> 
    <s:Body> 
     <m:Subscribe> 
      <m:PullSubscriptionRequest SubscribeToAllFolders=""> 
       <t:FolderIds /> 
       <t:EventTypes> 
        <t:EventType>CopiedEvent</t:EventType> 
        <t:EventType>CreatedEvent</t:EventType> 
        <t:EventType>DeletedEvent</t:EventType> 
        <t:EventType>ModifiedEvent</t:EventType> 
        <t:EventType>MovedEvent</t:EventType> 
        <t:EventType>NewMailEvent</t:EventType> 
        <t:EventType>FreeBusyChangedEvent</t:EventType> 
       </t:EventTypes> 
       <t:Watermark /> 
       <t:Timeout>1</t:Timeout> 
      </m:PullSubscriptionRequest> 
     </m:Subscribe> 
    </s:Body> 
</s:Envelope> 

然而,這將始終與文字An internal server error occurred. The operation failed.並沒有faultactor返回ErrorInternalServerError。我已經嘗試過這種方式,不用多餘的<t:FolderIds /><t:Watermark/>標籤。用不同的超時時間和不同的內容<t:EventTypes>

但是,當我手動刪除SubscribeToAllFolders="",並添加文件夾,如:

<?xml version="1.0" encoding="UTF-8"?> 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
    <s:Header> 
     <t:RequestServerVersion Version="Exchange2013_SP1" /> 
    </s:Header> 
    <s:Body> 
     <m:Subscribe> 
      <m:PullSubscriptionRequest> 
       <t:FolderIds> 
        <t:DistinguishedFolderId Id="inbox" /> 
       </t:FolderIds> 
       <t:EventTypes> 
        <t:EventType>CopiedEvent</t:EventType> 
        <t:EventType>CreatedEvent</t:EventType> 
        <t:EventType>DeletedEvent</t:EventType> 
        <t:EventType>ModifiedEvent</t:EventType> 
        <t:EventType>MovedEvent</t:EventType> 
        <t:EventType>NewMailEvent</t:EventType> 
        <t:EventType>FreeBusyChangedEvent</t:EventType> 
       </t:EventTypes> 
       <t:Watermark /> 
       <t:Timeout>10</t:Timeout> 
      </m:PullSubscriptionRequest> 
     </m:Subscribe> 
    </s:Body> 
</s:Envelope> 

我得到預期的迴應。

之前有人有過SubscribeToAllFolders的問題嗎?有沒有辦法讓它工作?我對EWS和SOAP相對來說比較新,所以我在做任何明確愚蠢的事情嗎?謝謝你的幫助。

回答

1

您的要求格式錯誤,不是如它應該看起來像

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
 
    <soap:Header> 
 
     <t:RequestServerVersion Version="Exchange2013_SP1" /> 
 
    </soap:Header> 
 
    <soap:Body> 
 
     <m:Subscribe> 
 
     <m:PullSubscriptionRequest SubscribeToAllFolders="true"> 
 
      <t:EventTypes> 
 
      <t:EventType>CopiedEvent</t:EventType> 
 
      <t:EventType>CreatedEvent</t:EventType> 
 
      <t:EventType>DeletedEvent</t:EventType> 
 
      <t:EventType>ModifiedEvent</t:EventType> 
 
      <t:EventType>MovedEvent</t:EventType> 
 
      <t:EventType>NewMailEvent</t:EventType> 
 
      </t:EventTypes> 
 
      <t:Timeout>5</t:Timeout> 
 
     </m:PullSubscriptionRequest> 
 
     </m:Subscribe> 
 
    </soap:Body> 
 
    </soap:Envelope>

我建議你看一下使用EWSEditor https://ewseditor.codeplex.com/做一些測試它都將會讓你測試操作併爲您提供用於每個請求和響應的SOAP。

+0

謝謝。問題是我沒有在'SubscribeToAllFolders'中設置''true''。我不認爲文件中特別清楚。一旦我改變了這一切,一切正常,沒有格式化或任何問題。 – SCB