Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm programatically creating a new site with associated groups (Owners, Members etc) in MOSS 2007

When the site is created, and groups associated with the site, the groups don't appear in the Groups Quick Launch, so there is no direct way to edit group membership without trawling through the list of all groups.

Is there an easy way/property to set in C# that will make the new groups appear in the site's Quick Launch?

Thanks,

Carl

share|improve this question

2 Answers 2

You need to add it to the appropriate SPWeb's propertybag.

if ( yourWeb.Properties.ContainsKey("vti_associategroups"))
{
    yourWeb.Properties["vti_associategroups"] += ";" + yourGroup.Id; // append to existing groups
    yourWeb.Properties.Update();
}
share|improve this answer

This worked for me and the group(s) show up as well. SPSite site = new SPSite("http://localhost"); SPWeb web = site.OpenWeb(); SPUser user = web.CurrentUser; web.SiteGroups.Add("MyGroup", user, user, "My description"); SPGroup g = web.SiteGroups["MyGroup"]; web.AssociatedGroups.Add(g); web.Update();

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.