2013-01-02 33 views
1

我想從特定日期(具有發生日期和定期主事件數據)的循環主日曆事件中檢索事件(ItemID)。Exchange EWS - 如何從特定日期的主事件中檢索事件?

我試圖的FindItem像這樣

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages"> 
    <soapenv:Header> 
     <typ:RequestServerVersion Version="Exchange2007_SP1"/> 
    </soapenv:Header> 
    <soapenv:Body> 
     <mes:FindItem Traversal="Shallow"> 
     <mes:ItemShape> 
      <typ:BaseShape>AllProperties</typ:BaseShape> 
     </mes:ItemShape> 
     <mes:Restriction> 
      <typ:IsEqualTo> 
       <typ:FieldURI FieldURI="item:RecurringMasterItemId"/> 
       <typ:FieldURIOrConstant> 
       <typ:Constant Value="AQMkAD[snip]AAAAA=="/> 
       </typ:FieldURIOrConstant> 
      </typ:IsEqualTo> 
     </mes:Restriction> 
     <mes:ParentFolderIds> 
      <typ:DistinguishedFolderId Id="calendar"/> 
     </mes:ParentFolderIds> 
     </mes:FindItem> 
    </soapenv:Body> 
</soapenv:Envelope> 

的限制,但這返回: 的「FieldURI」屬性無效 - 值「項目:RecurringMasterItemId」是無效的,根據其數據類型(類型:UnindexedFieldURIType ) - 枚舉約束失敗。
(我也知道定期約會的ChangeKey並嘗試過,發生同樣的錯誤)

這應該如何解決才能使其工作?

順便說一句。我知道與檢索的GetItem出現這樣的:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages"> 
    <soapenv:Header> 
     <typ:RequestServerVersion Version="Exchange2007_SP1"/> 
    </soapenv:Header> 
    <soapenv:Body> 
     <mes:GetItem> 
     <mes:ItemShape> 
      <typ:BaseShape>IdOnly</typ:BaseShape> 
     </mes:ItemShape> 
     <mes:ItemIds> 
      <typ:OccurrenceItemId RecurringMasterId="AQMkAD[snip]AAAA==" InstanceIndex="1"/> 
      <typ:OccurrenceItemId RecurringMasterId="AQMkAD[snip]AAAA==" InstanceIndex="2"/> 
      <typ:OccurrenceItemId RecurringMasterId="AQMkAD[snip]AAAA==" InstanceIndex="3"/> 
     </mes:ItemIds> 
     </mes:GetItem> 
    </soapenv:Body> 
</soapenv:Envelope> 

然後,我可能會通過這些檢索起始日期和循環,但沒有辦法,我可以預測可能適用的範圍InstanceIndex。

由於提前,

+0

如果任何人有EWS託管API代碼來做到這一點,也可能幫助我.... –

回答

0

它看起來並不像這是可能的。

我現在已經使用GetItem,一次檢索50個事件。

這將返回GetItemResponseMessages包含列表之一:

  • 成功的發生檢索

  • ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange responsecode表明我們已經到達了最後一次出現

  • 其他 '真正的' 錯誤

  • 錯誤CalendarOccurrenceIsDeletedFromRecurrence responsecode表明發生被刪除

所以我只是循環,直到我找到了正確的日期,達到ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange,或達到了我的代碼中設置呼叫的最大數量。

相關問題