【发布时间】:2017-02-18 19:51:40
【问题描述】:
我需要在我的项目中使用 sharepoint 客户端 api,并列出上传到 sharepoint 的文件夹中的文档。我的文件夹位于“https://mydomain.sharepoint.com/sites/blsmtekn/dyncrm/Shared%20Documents/Forms/AllItems.aspx”链接下
using (ClientContext ctx = new ClientContext("https://mydomain.sharepoint.com/"))
{
string userName = "username";
string password = "password";
SecureString secureString = new SecureString();
password.ToList().ForEach(secureString.AppendChar);
ctx.Credentials = new SharePointOnlineCredentials(userName, secureString);
List list = ctx.Web.Lists.GetByTitle("/Shared Documents/");
CamlQuery caml = new CamlQuery();
caml.ViewXml = @"<View Scope='Recursive'>
<Query>
</Query>
</View>";
caml.FolderServerRelativeUrl = "/sites/blsmtekn/dyncrm/";
ListItemCollection listItems = list.GetItems(caml);
ctx.Load(listItems);
ctx.ExecuteQuery();
}
但我收到类似“列表...在具有 URL 的站点不存在”之类的错误。如何递归获取该文件夹下的文件夹和文件列表。
【问题讨论】:
标签: c# sharepoint sharepoint-2010 sharepoint-clientobject