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?

2 Answers 2


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.

  • 1
    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... Commented Jan 4, 2012 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 = "http://domain.com/managedpath/siteurl"

$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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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