Counting Usage of SP2010 UPS User Properties


I needed to report on the usage count of particular UPS user properties such as Skills and Responsibilities. If you look at the property in Central Administration, you can see a usage count on the screen. This field is populated using an internal class so I needed to look for another way to do it. When looking, I found the following property:

Microsoft.Office.Server.UserProfiles.CoreProperty.UsageCount

However, when you go to use it, it does not return a value and you will find it is producing a SQL error. You can find all the ins and outs of the issue in this blog post:

http://pholpar.wordpress.com/2010/03/12/bug-in-the-usecount-property-of-the-coreproperty-class/

However, the resolution in this blog post is NOT supported by Microsoft as it requires modifying the SharePoint database. After a quick call with Microsoft, I learned you can use this method to get the count:

Microsoft.Office.Server.UserProfiles.UserProfileConfigManager.CountProfileswithProperty

Hopefully this will help someone else out who runs into this issue. Here is an example PowerShell script with the method used in it:

Add-Type -Path “c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.Office.Server.dll”
Add-Type -Path “c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.Office.Server.UserProfiles.dll”
$propertyName = “SPS-Skills”
$siteUrl = “http://dev”
$site = Get-SPSite $siteUrl
$context = Get-SPServiceContext $site
$upcm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($context)
Write-Host $upcm.CountProfilesWithProperty($propertyName)

About J.D. Wade

Lead Technical Cloud Architect, husband, active in community theatre, love watching movies, have been described as “quirky”, aka “KB Man”
This entry was posted in Microsoft SharePoint, SharePoint Server 2010 (SP 2010) and tagged . Bookmark the permalink.

One Response to Counting Usage of SP2010 UPS User Properties

  1. Pingback: Office server | Connectmyheart

Join the discussion by leaving a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s