How to get list of files in a Folder in a SharePoint Library using CSOM?
Hello SharePointers, Below is the CSOM code to get the list of files in a folder in SharePoint library. ClientContext cxt = new ClientContext(“http://sharepointdev/”); List list = cxt.Web.Lists.GetByTitle(“MyDocuments”); cxt.Load(list); cxt.Load(list.RootFolder); cxt.Load(list.RootFolder.Folders); cxt.Load(list.RootFolder.Files); cxt.ExecuteQuery(); FolderCollection fcol = list.RootFolder.Folders; List listFile = new List(); foreach(Folder f in fcol) { if (f.Name == “Myfolder”) { cxt.Load(f.Files); cxt.ExecuteQuery(); FileCollection […]