SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to add a group (SPGroup) programmatically. Everything works fine except for one thing. I would like the group's description to include a link to it's site. Similiar to the look-and-feel in a normal Team Site where it says:

enter image description here

So I use the following code:

web.SiteGroups.Add("ts01 Administrators", owner, null, 
  "Use this group to grant people administrative permissions to the SharePoint site: <a href=\"http://ts01\">ts01</a>");

where "owner" is an instantiated, not null SPPrincipal.

The result I get is not the intended one. SharePoint seems to HtmlEncode everything I send in, and rightly so. But when I create a group using the GUI I can include links in the description. So what's the difference? Has anyone encountered this problem?

share|improve this question
up vote 9 down vote accepted

Yup, you've found another SharePoint-ism.

You'll need to the add the group like you're doing and then update the item in the SiteUserInfoList. We use the following static method:

public static void UpdateGroupDescription(SPWeb spWeb, SPGroup group, string descriptionString)
    SPListItem item = spWeb.SiteUserInfoList.GetItemById(group.ID);
    item[SPBuiltInFieldId.Notes] = descriptionString;

See also, basically the same question on StackOverflow.

share|improve this answer
Wonderful! I was digging through a lot of DLLs using Reflector to see how things actually worked. Pretty ingenious to use a field called Notes to hold a value for Description... – Björn Stenberg Jan 4 '12 at 16:55

Powershell version which i wrote based on the above sample.

$sharepointShell = "Microsoft.SharePoint.PowerShell"

if ( (Get-PSSnapin -Name $sharepointShell -ErrorAction SilentlyContinue) -eq $null )
{Add-PsSnapin $sharepointShell}
$newSiteTitle = "Title of the Site"
$newSiteURL = ""

$spWeb = Get-SPWeb -Site $newSiteURL
write-host -ForegroundColor DarkCyan "SPWeb object intialised"

# Owners Group
$ownerGroup = $spWeb.SiteGroups["$spWeb Owners"]
$ownerGroupItem = $spWeb.SiteUserInfoList.GetItemById($ownerGroup.ID)
$ownerGroupItem["Notes"] = "Use this group to grant people full control permissions to the SharePoint site: <a href=""$newSiteURL"">$newSiteTitle</a>"
write-host $ownerGroupItem["Notes"] 

#Dispose SPObjects
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.