我正尝试从远程Windows服务器以编程方式向我的SharePoint Online 2013(如Office 365)站点进行身份验证。我尝试了各种方法,但最有希望的是使用“客户端对象模型”SharePointOnlineCredentials。它在我的开发PC上工作正常,但在部署到我的服务器时失败(“FileNotFoundException:msoidcliL.dll”)。
如何让SharePointOnlineCredentials在我的服务器上运行?
我的c#代码:
protected void Page_Load(object sender, EventArgs e)
{
using (ClientContext clientContext = new ClientContext("https://mysite.sharepoint.com/"))
{
SecureString passWord = new SecureString();
foreach (char c in "mypassword".ToCharArray()) passWord.AppendChar(c);
clientContext.Credentials = new SharePointOnlineCredentials("myusername@mysite.onmicrosoft.com", passWord);
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
Lbl1.Text = web.Title;
}
}