2

How to set SharePoint List View 'Item Limit' programmatically with the option 'Display items in batches of the specified size.' selected.

By default, 'Limit the total number of items returned to the specified amount.' option is selected. I want to change it to 'Display items in batches of the specified size.'

enter image description here

1 Answer 1

2

Please try below mentioned code

    using System.Net;
    using Microsoft.SharePoint.Client;

    namespace ClientObjectModelConsoleApplication
    {
      class Program
      {
        static void Main(string[] args)
        {
          ClientContext clientContext = new ClientContext("http://hercules");
          clientContext.Credentials = new NetworkCredential("Administrator", "12345");
          string listName = "My Custom List", viewName = "All Items";



          // true is "Display items in batches of the specified size"
          // false is "Limit the total number of items returned to the specified amount"
          bool paged = true;      



          List list = clientContext.Web.Lists.GetByTitle(listName);
          View view = list.Views.GetByTitle(viewName);
          view.Paged = paged;
          view.Update();
          clientContext.ExecuteQuery();
        }
      }
    }
1
  • 1
    "view.Paged = true;" is working,..Thanks.. Mar 28, 2016 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.