Create DefaultSharepoint Groups
I am recently trying to create site collection using Admin Web Service. When site creating using admin web service, share point not creating default share point groups. You have to write custom code to create share point default groups. The following is the code to create default sp groups.
public bool CreateDefaultSPGroups(string url)
{
bool isGroupsCreated = false;
try
{
using (SPSite site = new SPSite(url))
{
using (SPWeb web = site.OpenWeb())
{
web.CreateDefaultAssociatedGroups(site.Owner.LoginName, site.SecondaryContact.LoginName, string.Empty);
isGroupsCreated = true;
}
}
}
catch (Exception ex)
{
isGroupsCreated = false;
}
return isGroupsCreated;
}
Comments