Skip to content

Instantly share code, notes, and snippets.

@vman
Last active August 27, 2017 15:33
Show Gist options
  • Save vman/4518430 to your computer and use it in GitHub Desktop.
Save vman/4518430 to your computer and use it in GitHub Desktop.
using (ClientContext clientContext = new ClientContext("https://yoursite.sharepoint.com/"))
{
var passWord = new SecureString();
foreach (char c in "yourpassword".ToCharArray()) passWord.AppendChar(c);
clientContext.Credentials = new SharePointOnlineCredentials("loginname@yoursite.onmicrosoft.com", passWord);
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
Console.WriteLine(web.Title);
Console.ReadLine();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment