SharePoint Online Credentials

using (ClientContext clientContext = new ClientContext("https://yoursite.sharepoint.com/"))
{
    SecureString passWord = new SecureString();
    foreach (char c in "yourpassword".ToCharArray()) passWord.AppendChar(c);
    clientContext.Credentials = new SharePointOnlineCredentials("[email protected]", passWord);
    Web web = clientContext.Web;
    clientContext.Load(web);
    clientContext.ExecuteQuery();
} 

猜你喜欢

转载自www.cnblogs.com/jackhu88/p/9208628.html