Question

I wanted to edit the Account Name (login) for a single user in our on-premises farm, so I went to User Profile Properties in SharePoint central admin, found the Account Name property and in Edit settings I set "Allow users to edit values for this property"

I was able to make the update fine. I then changed the Account Name edit setting back to "Do not allow users to edit values for this property", but found that I was still able to update the Account Names for users (to begin with I wasn't able to, changing the edit settings was necessary).

With the following script I was able to determine that the IsAdminEditable property of AccountName was still true. IsUserEditable is false.

    $site = Get-SPSite http://mycentraladmin:port
    $serviceContext = Get-SPServiceContext $site
    $upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)
    $accountNameProperty = $upm.Properties | where { $_.Name -eq "AccountName" } 
    $accountNameProperty.IsAdminEditable
    $accountNameProperty.IsUserEditable

IsAdminEditable is readonly here. My question is how can I set it back to false and make Account Name uneditable for both admins and users.

Était-ce utile?

La solution

There's no supported way to change this, so my suggestion would be just to use T-SQL to make the modification.

USE [ProfileDB]
UPDATE dbo.ProfileSubtypePropertyAttributes SET IsAdminEditOnly = 0, IsEditable = 0 WHERE PropertyId = 3;
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top