Is it possible to set who's the site owner when a new site is created programmatically? (SharePoint)
I am creating sites programmatically in a web part and I wonder if it's possible to set who the site owner is? By default the one who creates the site is the owner but I am going to use this web part for a customer and I don't want to be the owner of开发者_如何学JAVA the sites. Do I have to change this afterwards or is it possible to set when the site is created?
Thanks in advance.
The SPSite constructor takes the owner parameters right, can you just change that to who you want it to be?
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spsitecollection.add.aspx
If you are creating a site collection, use djeeg's suggestion. If you are creating a subsite, permissions will be inherited from the parent site by default unless you call BreakRoleInheritance. If that is the case, you can create a new group, assign it to the AssociatedOwnerGroup property, and then add the appropriate users to that group.
精彩评论