Skip to content

Instantly share code, notes, and snippets.

@vgrem
Created January 9, 2015 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgrem/2d0065a6a6d4e0ba56df to your computer and use it in GitHub Desktop.
Save vgrem/2d0065a6a6d4e0ba56df to your computer and use it in GitHub Desktop.
using (var ctx = new ClientContext(webUri))
{
ctx.Credentials = CreateSPOCredentials(userName, password);
var list = ctx.Web.Lists.GetByTitle(listTitle);
var item = list.GetItemById(itemId);
KeywordsManager.SetTaxKeywordValue(item,new []{"2013","2010"});
item.Update();
ctx.ExecuteQuery();
}
public static SharePointOnlineCredentials CreateSPOCredentials(string userName,string password)
{
var securePassword = new SecureString();
foreach (var ch in password)
{
securePassword.AppendChar(ch);
}
return new SharePointOnlineCredentials(userName, securePassword);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment