SharePoint 2010: Delete Manager from UserProfile

SharePoint 2010: Delete Manager from UserProfile

Today's task revolved around removing the Manager I set when testing the profile pages on the my site portal. I had set the manager on a service account so it had to be removed to stop appearing as a colleague to team members and potentially exposing a security risk in giving away the service account username.  Setting it is possible directly from the Organizational View page that comes as part of the site template. There is a link called "Set My Manager", which allows you to set the current UserProfile's manager. Once set though I wanted to remove this profile.

Unfortunately, there is no way for the user to remove their manager, only set the manager. So only an administrator can remove the manager.

Initially, being a powershell fanatic, I tried to remove the manager using the object model using the following powershell commands:
  • $site = get-spsite http://localhost
  • $context = Get-SPServiceContext $site
  • $mgr = new-object "Microsoft.Office.Server.UserProfiles.UserProfileManager" -ArgumentList $context
  • $enum = $mgr.GetEnumerator()
  • do {$enum.MoveNext();$usr = $enum.Current} until ($enum.Current["AccountName"] = "domain\username")
The following commands failed to remove the manager from the UserProfile:
  • $usr.Parent = $null     //Throws exception: "Setting Parent of a UserProfile is not allowed via OM."
  • $usr.Properties.RemovePropertyByName("Manager") // Throws exception: "Property update's Stored Procedure call returned an error. Error Code: 4. Errors removing P propert"
Funny, most things can be done easier through powershell. But in this instance Central Admin did the trick!
Central Administration -> Application Management -> Manage Service Applications -> User Profile Service (click Manager) -> Manager User Profiles.
Using "Find profile" enter the account name, and select "Edit My Profile" from the drop down when selecting the account. From this page you can change the manager and set it to nothing and click "Save and Close" to apply the new value.

That's it! There is no single way to manage Sharepoint, you need to know all the tools available as some have strengths over others. Central Admin wins over powershell on this one for user-friendlyness (it just worked).
Leave a Comment
  • Please add 2 and 6 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Richard Mueller edited Revision 1. Comment: Removed (en-US) from title, added tags

  • Craig Lussier edited Original. Comment: added en-US to tags and title

Page 1 of 1 (2 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Craig Lussier edited Original. Comment: added en-US to tags and title

  • Richard Mueller edited Revision 1. Comment: Removed (en-US) from title, added tags

Page 1 of 1 (2 items)