次の方法で共有


ListItemCollectionPosition Class

Specifies the information required to get the next page of data for a list view.

Inheritance Hierarchy

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

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<ScriptTypeAttribute("SP.ListItemCollectionPosition", ValueObject := True,  _
    ServerTypeId := "{922354eb-c56a-4d88-ad59-67496854efe1}")> _
Public NotInheritable Class ListItemCollectionPosition _
    Inherits ClientValueObject
'Usage
Dim instance As ListItemCollectionPosition
[ScriptTypeAttribute("SP.ListItemCollectionPosition", ValueObject = true, 
    ServerTypeId = "{922354eb-c56a-4d88-ad59-67496854efe1}")]
public sealed class ListItemCollectionPosition : ClientValueObject

Examples

This code example displays titles, two at a time, from the list of announcements on the specified site.

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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ListItemCollectionPosition Members

Microsoft.SharePoint.Client Namespace