Paging is not working in here, the error it says : The query expression is not supported.
Error occurs in this line:
clientContext.Load(listItems, itms => itms.Skip((PageNumber - 1) * PageSize).Take(PageSize));
Could someone advise Please?
Thanks
/// <summary>
/// Method to return list of documents of a specific document library
/// </summary>
/// <param name="docLibaryName"></param>
/// <returns></returns>
public List<Document> GetDocumentsByLibraryName(string spURL, string docLibaryName, int PageSize, int PageNumber)
{
List<Document> docList = new List<Document>();
//Access the Document Library
ClientContext clientContext = new ClientContext(spURL);
List sharedDocumentsList = clientContext.Web.Lists.GetByTitle(docLibaryName);
//Specify the Caml Query
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml =
@"<View Scope='Recursive'></View>";
ListItemCollection listItems = sharedDocumentsList.GetItems(camlQuery);
clientContext.Load(listItems, itms => itms.Skip((PageNumber - 1) * PageSize).Take(PageSize));
clientContext.ExecuteQuery();
AddItemsToDocumentCollection(docList, listItems);
return docList.ToList();
}