Thursday, February 13, 2014

Restore UserDisp.aspx and UserEdit.aspx functionality after a User Profile Application has been removed

Before you provision a User Profile Application you may edit a users properties like e-mail and picture by clicking on your name and going to My Settings.

image

This takes you to _layouts/userdisp.aspx where you may click Edit Item to change your properties on the _layouts/useredit.aspx form.

Once you provision a User Profile Application you will not be sent to this page, but rather to your profile page instead.

I recently set up a demo environment where we did provision UPA, but decided we didn’t need it and thus removed it. This restores the link to My Settings, but once you click Edit Item you are presented with an empty form – major bummer!

image

As it turns out, when you provision a UPA it will set the fields in hidden site user info list to read only and hidden. An easy way to restore the form is to run the following via PowerShell which makes the fields visible and editable.

$web = Get-SPWeb http://intranet.contoso.com/
$names = "Title", "EMail", "MobilePhone", "Notes", "SipAddress", "Picture", "Department", "JobTitle"
foreach( $name in $names )
{
    $f = $web.SiteUserInfoList.Fields.GetFieldByInternalName($name);
    $f.Hidden = $false
    $f.ReadOnlyField = $false
    $f.Update()
}

Now you may yet again edit your properties.

image