Creating Client Context in SharePoint 2013 CSOM
private static ClientContext spAuthentication(string path,string username, string pwd)
{
ClientContext ctx = new ClientContext(path);
SecureString secStr = new SecureString();
if (pwd.Length > 0)
{
foreach (var c in pwd.ToCharArray())
{
secStr.AppendChar(c);
}
}
ctx.Credentials = new SharePointOnlineCredentials(username, secStr);
return ctx;
}
No comments:
Post a Comment