Я просматриваю свой экземпляр, https://instance.sharepoint.com/1234/abc
На этой странице содержится список из нескольких папок и файлов. Как мне загрузить файлы по этому пути?
ClientContext cxt = new ClientContext(fullWebUrl);
cxt.Credentials = new SharePointOnlineCredentials(username, new NetworkCredential("", password).SecurePassword);
List list = cxt.Web.Lists.GetByTitle("Documents");
cxt.Load(list);
cxt.ExecuteQuery();
FolderCollection fcol = list.RootFolder.Folders;
List<string> lstFile = new List<string>();
foreach (Folder f in fcol)
{
if (f.Name == "filename")
{
cxt.Load(f.Files);
cxt.ExecuteQuery();
FileCollection fileCol = f.Files;
foreach (Microsoft.SharePoint.Client.File file in fileCol)
{
lstFile.Add(file.Name);
}
}
}
Это происходит на foreach с ошибкой
Microsoft.SharePoint.Client.CollectionNotInitializedException: 'The collection has not been initialized
Не будет cxt.ExecuteQuery
делать работу?