How to change ‘Number of items to display’ for a Sharepoint list view programmactially 2013 or Office 365?

Hello SharePointers,

In this blog, we will discuss about how to change the number of items to display in a SharePoint list view using CSOM . Below is the CSOM code to achieve the same. Rowlimit is the property that we need to set it up.

public static void RowLimit(Web web, string listTitle,string viewTitle,int rowLimit)
{
var context = web.Context;
var list = web.Lists.GetByTitle(listTitle);
var view = list.Views.GetByTitle(viewTitle);
view.RowLimit = rowLimit;
view.Update();
context.ExecuteQuery();
}

using (var ctx = new ClientContext(url))
{
RowLimit(ctx.Web, “Myfiles”, “All Documents”,20);
}

Happy Sharepointing folks 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *