samedi 13 décembre 2014

Adding Site Collection Owners http://ift.tt/1wLKIlv



I'm trying to add an account to the site collection owners on users personal sites. I' using the following but get this error: You need to be a site collection administrator to set this property.



User spUser = null;
using (ClientContext clientContext = new ClientContext(siteURL)) {
clientContext.Credentials = credentials;
if (clientContext != null)
{
spUser = clientContext.Web.EnsureUser(userAccount);
spUser.IsSiteAdmin = true;
spUser.Update();

clientContext.Load(spUser);
clientContext.ExecuteQuery();
}
}


On http://ift.tt/1wLKIlv the user is under site collection Administrators.








0 commentaires:

Enregistrer un commentaire