iT邦幫忙

0

[SharePoint 2010] 大型清單存取問題

  • 分享至 

  • twitterImage

版上的各位大家好
最近升級sharePoint 2010後在大型清單存取上新增了Throttling的限制,導致部分程式必須重新改寫嘗試很多種方法但都回傳"已禁止嘗試的作業,因為該作業超過管理員強制設定的清單檢視閥值。"目前系統的邊使用者Throtlng限制為5000,管理者為20000。
我嘗試了以下寫法但都不能正常運作,還請各位幫忙看一下,謝謝!

private void Get()
     {
         SPQuery oQuery = new SPQuery();
         oQuery.RowLimit = 2000;
         int intIndex = 1;
         oQuery.ViewFields = string.Concat("<FieldRef Name='CheckoutUser' />");
        oQuery.ViewFieldsOnly = true;
        oQuery.QueryThrottleMode = SPQueryThrottleOption.Override;
        oQuery.Query = "<Where><Eq><FieldRef Name=\"CheckoutUser\" /><Value Type=\"User\">" + Label1.Text + "</Value></Eq></Where>";
        SPListItemCollection collListItems = oList.GetItems(oQuery);
        do{
             foreach (SPListItem oListItem in collListItems)
             {
            
             }
             oQuery.ListItemCollectionPosition = collListItems.ListItemCollectionPosition;
        } while (oQuery.ListItemCollectionPosition != null);
     }
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

4
最佳解答

感謝您的回答!
我嘗試使用 ContentIterator 時也是一樣回報給我超過限制的問題,
上面那段程式碼在foreach那段會出現錯誤,真的很不懂到底錯在哪...

我要發表回答

立即登入回答