Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am writing a program where I want to be able to add/remove user/groups as administrator for a given Site Collection. I am using Client Object Model API for SharePoint 2010. I havent been able to find any API which would allow me to do that. Is this something which is even possible via Client Object Model? If yes how ?

share|improve this question
add comment

2 Answers

You can't do that with 2010 client object model but it is now possible with 2013.

For promoting a user to Site collection admin we need to:

  • Set the IsSiteAdmin property to true.

Having said that you can't set the IsSiteAdmin property via 2010 client object model.

However, it is quite possible to do it via:

  • Server side object model
  • PowerShell
share|improve this answer
    
This answer more precisely addresses the initial question, so +1 –  Alexey Krasheninnikov Oct 22 '13 at 19:54
add comment

EDIT

just looked over the code and your right it doesnt work, I had a deep look at the webservices ootb provided by sharepoint and there is no function to perform the job!! so the next solution would be to make your own webservice that does it for you!

within the webservice add:

public bool SetSiteCollAdmin(string siteURL,string userAccount)
{ 
   using(SPSite site=new SPSite(siteURL)) 
   { 
      using (SPWeb web = site.RootWeb) 
      { 
          SPUser user = web.EnsureUser(userAccount); 
          user.IsSiteAdmin = true; 
          user.Update();
          return true;
      } 
   } 
   return false;
}

call that method with Ajax soap call.

to create a webservice follow:

http://msmvps.com/blogs/windsor/archive/2011/11/04/walkthrough-creating-a-custom-asp-net-asmx-web-service-in-sharepoint-2010.aspx

share|improve this answer
    
Although you add value, the answer is not strictly on topic and misleads. By adding users to groups you don't grant them IsSiteAdmin status. –  Alexey Krasheninnikov Oct 22 '13 at 19:53
    
im sorry @AlexeyKrasheninnikov but your missing the op question, "I want to be able to add/remove user/groups as administrator for a given Site Collection." This answer is on topic and is not misleading what so ever the code above removes the user from a selected group using that webservice, tweaking it can also remove user! –  ali Sharepoint Oct 22 '13 at 23:56
    
I agree with @AlexeyKrasheninnikov. What you have mentioned is adding a user to a group. I am not sure how this solves my problm of making a user site administrator –  Ashish Jhunjhunwala Oct 23 '13 at 9:57
1  
just ammended my solution! sorry for the run around ;) –  ali Sharepoint Oct 23 '13 at 10:34
    
Well, it's actually quite a different answer. You probably shouldn't have removed the initial response completely - now the comments are out of context. –  Alexey Krasheninnikov Oct 30 '13 at 7:32
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.