我有一个WinForms应用程序,我需要从SharePoint OneDrive目录下载文件。 目前,鉴于我下面的代码,我能够读取该文件标题,但我无法找到任何东西帮我下载使用Microsoft.SharePoint.Client的代码。
string username = "appuser@abcuseraccount.com";
String pwd = "x!@ex";
ClientContext context = new ClientContext("https://abcuser.sharepoint.com/Main/financial/");
SecureString password = new SecureString();
foreach (char c in pwd.ToCharArray())
{
password.AppendChar(c);
}
context.Credentials = new SharePointOnlineCredentials(username, password);
context.ExecuteQuery();
List docs = context.Web.Lists.GetByTitle("Financial Notes");
Web site = context.Web;
context.Load(site);
context.ExecuteQuery();
CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
ListItemCollection items = docs.GetItems(query);
context.Load(items);
context.ExecuteQuery();
foreach (ListItem listItem in items)
{
MessageBox.Show(listItem["Title"].ToString());
}
我怎样才能下载文件到本地驱动器(不使用LiveAccount AUTH)?