2012-10-10 23 views

回答

8

2,147,483,647的數據類型爲Int32, 。我使用它並測試了它,如果通過ItemView(2147483647),它不會返回任何錯誤;

這只是定義搜索項的頁面大小,如果有更多的搜索項結果不是視圖頁面大小,使用ItemView控件偏移必須進行後續調用返回結果的其餘部分。

裁判 - http://msdn.microsoft.com/en-us/library/exchange/dd633693%28v=exchg.80%29.aspx http://msdn.microsoft.com/en-us/library/system.int32.maxvalue.aspx

5

您可以指定ItemView控件構造的Int32值,但只有一千項目將被returnd。你必須指定一個循環來獲取剩餘的項目。

 bool more = true; 
     ItemView view = new ItemView(int.MaxValue, 0, OffsetBasePoint.Beginning); 
     view.PropertySet = PropertySet.IdOnly; 
     FindItemsResults<Item> findResults; 
     List<EmailMessage> emails = new List<EmailMessage>(); 
     while (more) 
     { 
      findResults = service.FindItems(WellKnownFolderName.Inbox, view); 
      foreach (var item in findResults.Items) 
      { 
       emails.Add((EmailMessage)item); 
      } 
      more = findResults.MoreAvailable; 
      if (more) 
      { 
       view.Offset += 1000; 
      } 
     } 
+0

謝謝!!這給了我很大的時間 – Kage