1

Is there a way to delete the values of User Profile Property Office for all users via Powershell or CA?

2
  • are u on sharepoint online or farm? Mar 17, 2014 at 16:16
  • If Central Admin exists, it's on premise (says CA in post) @SalvatoreDiFazio Mar 17, 2014 at 17:52

1 Answer 1

1

Option 1: Central Admin > Application Management > Manage Service Applications > User Profile Service (whatever you have it named as) > Manage User Properties ... Scroll down until you find 'Office' then just delete it and recreate it. Its just a string field, nothing to it. Unless you have it mapped to AD, then you might have to remap it. Or if its not needed, just delete it and move on.

Option 2: Recommended There is a powershell command to set user profile values: The user launching this must have both admin and permission set, to check this, highlight your service in CA, then on the top ribbon you will see 'Administrators' and 'Permissions' just open both to make sure that the account is in both:

Add-PSSnapin Microsoft.SharePoint.Powershell

$Site = Get-SPSite -Limit 1
$ServiceContext = Get-SPServiceContext($Site)
$ProfileManager = new-object   Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)
$Profiles = $ProfileManager.GetEnumerator()

foreach($profile in $Profiles) {
  $profile["Office"].Value = "";
  $profile.Commit();
}

This line: $Site = Get-SPSite -Limit 1 was a little trick I picked up from the "Scripting Guys', figured I'd give credit where credit is due.

2
  • Go with Option 2, I would not delete the out of the box fields from the User Profile Service. Mar 18, 2014 at 15:37
  • Agreed, I meant to put Recommended next to option 2, thanks for calling it out. Personally, I am starting to love powershell, but that is another conversation haha.
    – Oddity
    Mar 18, 2014 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.