【发布时间】:2018-08-15 05:25:01
【问题描述】:
问题。我有这个返回类型为“列表项集合”的方法,我在 SharePoint 中的列表包含 5000 多个项目。为了克服阈值,我需要通过设置行限制来批量获取项目,但我不知道该放什么来代替??因此返回类型也是“ListItemCollection”(SharePoint 客户端上下文)。请帮忙
private static ListItemCollection GetItemsFromSharePointSiteList(string strListName, string strCamlQuery, ClientContext clientContext)
{
try
{
ListItemCollectionPosition itemPosition = null;
List listIPPMilestonesLE = clientContext.Web.Lists.GetByTitle(strListName);
CamlQuery query = new CamlQuery();
query.ViewXml = strCamlQuery;
query.DatesInUtc = false;
// ListItemCollection itemColl = new ListItemCollection();
do
{
Microsoft.SharePoint.Client.ListItemCollection listItemCollection = listIPPMilestonesLE.GetItems(query);
clientContext.Load(listItemCollection);
clientContext.ExecuteQuery();
foreach (ListItem oListItem in listItemCollection)
{
??
}
itemPosition = listItemCollection.ListItemCollectionPosition;
} while (itemPosition != null);
return null;
}
catch (Exception exc)
{
ErrorLog.Error(exc);
}
return null;
}
【问题讨论】:
标签: c# list sharepoint threshold