Last active
August 29, 2015 14:13
-
-
Save Zimmergren/104cc088eb8c0cef74de to your computer and use it in GitHub Desktop.
WebJobs Demo Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
using (ClientContext context = new ClientContext("https://redacted.sharepoint.com")) | |
{ | |
context.AuthenticationMode = ClientAuthenticationMode.Default; | |
context.Credentials = new SharePointOnlineCredentials(GetSPOAccountName(), GetSPOSecureStringPassword()); | |
// TODO: Add any awesome code here! | |
} | |
} | |
private static SecureString GetSPOSecureStringPassword() | |
{ | |
try | |
{ | |
Console.WriteLine(" --> Entered GetSPOSecureStringPassword()"); | |
var secureString = new SecureString(); | |
foreach (char c in ConfigurationManager.AppSettings["SPOPassword"]) | |
{ | |
secureString.AppendChar(c); | |
} | |
Console.WriteLine(" --> Constructed the secure password"); | |
return secureString; | |
} | |
catch | |
{ | |
throw; | |
} | |
} | |
private static string GetSPOAccountName() | |
{ | |
try | |
{ | |
Console.WriteLine(" --> Entered GetSPOAccountName()"); | |
return ConfigurationManager.AppSettings["SPOAccount"]; | |
} | |
catch | |
{ | |
throw; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment