[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Create a sharepoint site and add an owner using code

Posted on 2011-03-09
6
Medium Priority
?
833 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:Capt_Ron
  • 3
  • 2
6 Comments
 
LVL 1

Author Comment

by:Capt_Ron
ID: 35089649
Do you know of a version of this using VB or C#?
0
 
LVL 6

Expert Comment

by:sabby447
ID: 35089687
Not in total however here is a pointer which may help you : http://www.codekeep.net/snippets/0301b30a-cdf9-4dd2-bbd0-0be4ad6c1a90.aspx 
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Accepted Solution

by:
sabby447 earned 1000 total points
ID: 35089690
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
 
LVL 14

Assisted Solution

by:KoenVosters
KoenVosters earned 1000 total points
ID: 35092133
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
 
LVL 1

Author Closing Comment

by:Capt_Ron
ID: 35201645
Between the two, I was able to figure it out.  Thanks.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question