Quickly determine unique values in a SharePoint field

Report on unique values in a SharePoint field

Ever need to know which values are in use for a multi-select field? Here’s a quick and easy way to do it:

$web= Get-SPWeb "http ://SharePoint/SPWeb/"
$FieldName="Activity" # use your own field name
$list = $web.Lists["ListName"]
$activities = @()
foreach($doc in $list.Items) { $activities += $doc[$FieldName] }
$activities | Select-Object -Unique | Sort-Object 

This makes for a good case for slimming the values down to those that were ever used.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *