Skip to content

Instantly share code, notes, and snippets.

@IAMIronmanSam
Forked from vman/sp15OAuth.cs
Last active August 29, 2015 14:11
Show Gist options
  • Save IAMIronmanSam/53ac9acc0af293469533 to your computer and use it in GitHub Desktop.
Save IAMIronmanSam/53ac9acc0af293469533 to your computer and use it in GitHub Desktop.
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("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