Sunday, February 5, 2012

Manage User Properties Change Display Order buttons are not working

Manage User Properties Page enables the User Profiles Service Application administrator to manage the user profile properties. He can ِِِAdd, Edit, Map, or Change the Display Order of the properties in My Profile Page.
Figure (1) Manage User Profile Service Application Page

One of the problems which I faced with Change Display Order buttons shown in Figure (2), that when I press on Move Up or Move Down buttons that it has no effect on the order and the order stay as it is.


Figure (2) Manage User Properties Page
 
After investigation and diagnosing the problem, I exported the list of the properties using the following PowerShell Script:

Add-Type -Path "c:\program files\common files\microsoft shared\web server extensions\14\isapi\microsoft.office.server.dll"
$site = Get-SPSite http://intranet.contoso.com:80/my/
$context = Get-SPServiceContext $site
$upConfigManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($context)
$profilePropertyManager = $upConfigManager.get_ProfilePropertyManager()
$pspm = $upConfigManager.GetProperties()
$pspm | Export-CSV c:\productionProp.csv
$site.Dispose() 

The result of executing the script shown in Figure (3).

Figure(3)  Export user properties result 

I found that some properties have the same Display Order Index value. So, I thought that this could be the reason. So, I wrote another PowerShell script to reset the Display Order index value for all the properties starting from 0 until the last property index. The following is the PowerShell Script which I used to reset the index:

Add-Type -Path "c:\program files\common files\microsoft shared\web server extensions\14\isapi\microsoft.office.server.dll"
$site = Get-SPSite http://intranet.contoso.com:80/my/
$context = Get-SPServiceContext $site
$upConfigManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($context)
$profilePropertyManager = $upConfigManager.get_ProfilePropertyManager()
$pspm = $upConfigManager.GetProperties()

$index = 0
$pspm.GetEnumerator() | ForEach-Object {
    $pspm.SetDisplayOrderByPropertyName($_.Name , $index)
    $pspm.CommitDisplayOrder()

    $index = $index +1
}
$site.Dispose()

After executing the script I tested the buttons to change the order of the properties and it works perfect again.

Note: This script resets the order of the properties, and it does not include the sections.

If you have any comments or questions, please don’t hesitate to post your comment.