The SharePoint Group object has a property named "Description", but it appears to be ignored. When you edit a group in the browser there is no "Description" field, but there is one named "About Me" that is a rich text field. Turns out there's a few secrets you need to know to set this seemly simple little property.
Secret #1: Many of the group's properties are stored in another object, the SPWeb.SiteUserInfoList object.
Secret #2: The internal name of "About Me" is "Notes".
The PowerShell:
#create the group as usual and then retrieve it... $web = $site.RootWeb; $group = $web.SiteGroups["Test Group with HTML desc"]; #find the group's SiteUserInfoList info... $groupInfo = $web.SiteUserInfoList.GetItemById($group.id); #update the text... $groupInfo["Notes"] = "<div>This is <strong>bold</strong> and this is <em>italics</em></div>"; #and save it... $groupInfo.Update();
For a C# example see the answer in this discussion: http://stackoverflow.com/questions/968819/change-description-of-a-sharepoint-group
.
No comments:
Post a Comment