ListItemCollectionPosition 类

指定获取列表视图的下一页数据所需的信息。

继承层次结构

System.Object
  Microsoft.SharePoint.Client.ClientValueObject
    Microsoft.SharePoint.Client.ListItemCollectionPosition

命名空间:  Microsoft.SharePoint.Client
程序集:   Microsoft.SharePoint.Client.Silverlight(位于 Microsoft.SharePoint.Client.Silverlight.dll 中);  Microsoft.SharePoint.Client.Phone(位于 Microsoft.SharePoint.Client.Phone.dll 中)  Microsoft.SharePoint.Client(位于 Microsoft.SharePoint.Client.dll 中)

语法

声明
Public Class ListItemCollectionPosition _
    Inherits ClientValueObject
用法
Dim instance As ListItemCollectionPosition
public class ListItemCollectionPosition : ClientValueObject

示例

此代码示例显示标题,两次,从列表中指定的网站上的公告。

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class ListItemCollectionPositionExample
    {
        static void Main()
        {
            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web; 

            List targetList = site.Lists.GetByTitle("Announcements");
            CamlQuery query = new CamlQuery();
            query.ViewXml = "<View><ViewFields><FieldRef Name='Title'/></ViewFields><RowLimit>2</RowLimit></View>";
            ListItemCollection collListItem = targetList.GetItems(query);

            clientContext.Load(collListItem);
            clientContext.ExecuteQuery();

            string msg = "Titles, two at a time:\n";
            foreach (ListItem myListItem in collListItem)
               msg += "\nTitle=" + myListItem["Title"];
            Console.WriteLine(msg);

            ListItemCollectionPosition position = collListItem.ListItemCollectionPosition;

            do
            {
               msg = "";
               query.ListItemCollectionPosition = position;
               collListItem = targetList.GetItems(query);
               clientContext.Load(collListItem);
               clientContext.ExecuteQuery();
               position = collListItem.ListItemCollectionPosition;

               foreach (ListItem myListItem in collListItem)
                  msg += "\nTitle=" + myListItem["Title"];
               Console.WriteLine(msg);

            } while (position != null);
        }
    }
}

线程安全性

该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。

另请参阅

引用

ListItemCollectionPosition 成员

Microsoft.SharePoint.Client 命名空间