У меня есть следующий код:
ClientContext context = new ClientContext("https://Website.sharepoint.com/sites/Subsite");
context.Credentials = new SharePointOnlineCredentials(Username, GetPasswordFromConsoleInput(Password));
context.Load(context.Web);
List list = context.Web.Lists.GetByTitle("Documents");
context.ExecuteQuery();
CamlQuery query = new CamlQuery();
query.FolderServerRelativeUrl = "Documents/Folder1/Folder2/Folder3";
query.ViewXml = @"<View Scope='Recursive'>
<Query>
</Query>
</View>";
ListItemCollection folderItems = list.GetItems(query);
context.Load(folderItems);
context.ExecuteQuery();
foreach (ListItem li in folderItems)
{
Microsoft.SharePoint.Client.File file = li.File;
if (file != null)
{
//how to download all files
}
}
//How to download one single file in the root "Documents" folder with specific name
1) Мне нужно, чтобы он подключился к веб-сайту SharePoint365 и загрузил все файлы в определенной папке в библиотеке дочернего сайта.Файлы находятся в 3-й папке библиотеки документов.Файлы должны идти в сетевую папку \\server\d$\files
2) Мне нужно сделать то же самое, но только для одного файла в корневом каталоге библиотеки документов с определенным именем.
Теперь это дает мне эту ошибку: 'The 'query.FolderServerRelativeUrl' argument is invalid.'
Спасибо за любую помощь!