共用方式為


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);
        }
    }
}

執行緒安全

這類型的任何公用 static (共用 於 Visual Basic 中) 成員是安全執行緒。不保證任何執行個體成員都是安全執行緒。

請參閱

參照

ListItemCollectionPosition 成員

Microsoft.SharePoint.Client 命名空間