Hi,
Im trying to delete a default User Property in UserProfileManager, I'm using the following PS
$site = Get-SPSite http://url $serviceContext = Get-SPServiceContext $site $upcm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($serviceContext) $pdtc = $upcm.GetPropertyDataTypes() $ppm = $upcm.ProfilePropertyManager $cpm = $ppm.GetCoreProperties() $property = $cpm.GetPropertyByName("SPS-School") $propertyName=$property.Name if($propertyName -ne $null) { $cpm.RemovePropertyByName($propertyName) write-host -f yellow property is deleted successfully } else { write-host -f red property does not exist }
But when I executed this script I receive an error message like:
Exception calling "RemovePropertyByName" with "1" argument(s): "Property
update's Stored Procedure call returned an error. Error Code: 4. Errors
removing properties: 1. Errors updating or creating properties: 0."
At line:3 char:1
+ $cpm.RemovePropertyByName($propertyName)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : CommitFailedException
Is not possible to delete the default properties? Only is it possible to hide them?
Thanks