Hi everyone I have a Folder1 in my Server and inside that folder I have a Folder2 folder. So I am getting the file which is inside the Folder1 with this code:
public static SPClient.ListItemCollection GetPageItems(string listName = "Folder1")
{
var pagesList = SharePointTools.ClientContext.Web.Lists.GetByTitle(listName);
var pageItems = pagesList.GetItems(CamlQuery.CreateAllItemsQuery());
SharePointTools.ClientContext.Load(pageItems);
SharePointTools.ClientContext.Load(pageItems, list => list.Include(page => page.DisplayName));
SharePointTools.ClientContext.ExecuteQuery();
return pageItems;
}
So it is using GetByTitle method but I can't get the files which is inside my Folder2. So how I can get all files inside my Folder2? Can someone answer?
Folder2
sub folder in your example?CamlQuery.CreateAllItemsQuery
returns all the items including from sub folders..