Reputation: 445
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 the sites. Do I have to change this afterwards or is it possible to set when the site is created?
Thanks in advance.
Upvotes: 0
Views: 1161
Reputation: 10335
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.
Upvotes: 0
Reputation: 6765
The SPSite constructor takes the owner parameters right, can you just change that to who you want it to be?
Upvotes: 2