Quantcast
Viewing latest article 13
Browse Latest Browse All 17

Using PowerShell to Update a SharePoint Site Group Description

This post is in response to a comment that I received on a previous post. The comment essentially asked how you would go about updating the “About Me” (Description) of a SharePoint Site Group.

You would think that you could just grab the SPGroup object, set the description, update, and you would be fine. Unfortunately, that is not the case. In order to update that you actually need to get the SPListItem from the User Information List and update it from there.

Below is a short PowerShell script to achieve that:

param([string]$Url, [string]$GroupName, [string]$Description)
 
$web = Get-SPWeb $Url;
$group = $web.SiteGroups[$GroupName];
$descriptionField = [Microsoft.SharePoint.SPFieldMultiLineText]$web.SiteUserInfoList.Fields[[Microsoft.SharePoint.SPBuiltInFieldId]::Notes];
$groupItem = $web.SiteuserInfoList.GetItemById($group.ID);
$groupItem[$descriptionField.InternalName] = $Description;
$groupItem.Update();
$web.Dispose();
 
Write-Host("`nGroup Description Updated: " + $groupItem[$descriptionField.InternalName]);

To use this, just copy the above source, paste it into a text file, save as Update-SPGroupDescription.ps1, and finally run through the SharePoint Management Shell. An example initial run should look something like this:

./Update-SPGroupDescription.ps1 -Url http://devurl -GroupName Group1 -Description “This is the new description”

If that goes well, the prompt should display the new description.

References:

http://stackoverflow.com/questions/968819/change-description-of-a-sharepoint-group

The post Using PowerShell to Update a SharePoint Site Group Description appeared first on MetroStar Systems Blog.


Viewing latest article 13
Browse Latest Browse All 17

Trending Articles