Authenticating in Office 365

Code Samples, Office 365, SharePoint

The following SharePoint 2013 code will connect to Office 365 and load the Web properties using CSOM:

ClientContext spctxt = new ClientContext(url);
SharePointOnlineCredentials cred = new SharePointOnlineCredentials(username, SecureStringFromString(password));
spctxt.Credentials = cred;

For both 2013 and 2010 versions, you need the code from Wiktor Wilen’s post:



What do you think?