Create a sharepoint site and add an owner using code

I need to write some code to create a sharepoint site, create a specific Member, Visitor, and Owners group and add a user to the owner's group.
I have the code to create the site, but I can't figure out how to create the 3 groups and add a user to one of the groups.
Thanks
Ron
LVL 1
Capt_RonIT Solutions ManagerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sabby447Connect With a Mentor Commented:
Some more :

http://sarangasl.blogspot.com/2009/12/add-user-to-sharepoint-user-group.html
http://msdn.microsoft.com/en-us/library/ms412944.aspx

I will try in my environment as well to see if this works .. Just sharing to get you started as well
0
 
Capt_RonIT Solutions ManagerAuthor Commented:
Do you know of a version of this using VB or C#?
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
sabby447Commented:
Not in total however here is a pointer which may help you : http://www.codekeep.net/snippets/0301b30a-cdf9-4dd2-bbd0-0be4ad6c1a90.aspx 
0
 
KoenVostersConnect With a Mentor Commented:
You have to use the SpGroup class:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spgroup.aspx
Adding users is done with the AddUser method:
http://msdn.microsoft.com/en-us/library/ms454048.aspx
0
 
Capt_RonIT Solutions ManagerAuthor Commented:
Between the two, I was able to figure it out.  Thanks.
0
All Courses

From novice to tech pro — start learning today.