1

Is there a way to show/hide/Change the user profile properties based on the value of another user profile property

For Eg :

I have a custom Boolean user property and when the user checked the box i want to change the privacy policy of another property this doesn't need to be automatic

I am planning on writing a powershell and do it as a scheduled task which will check each hourly if the property is checked and if so it will change the privacy policy

But in the power shell i am unable to read the value of Boolean property when i am using Userprofile["SHowHide"].Value .Can someone please suggest me where i am going wrong ?

Thanks

  • What is the source of your User Profiles? Active Directory Domain Services or something else? If you use AD, have you Grant Active Directory Domain Services permissions for profile synchronization or is the syncronization account only allowed to read AD? – Benny Skogberg Sep 12 '13 at 6:22
  • My main source is Active Directory and the account i am using has replicate permissions on the Actiev directory ,But the field i am using right now is a custom boolean property and will be filled by the users – Anil Sep 12 '13 at 12:32
3

Disregarding what you are trying to do. The PowerShell to accomplish the read of the boolean field looks like this. (Tested in 2013)

$context = Get-SPServiceContext -Site http://mysite
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$up = $upm.GetUserProfile("DHT\Ruby")
$up["ShowHide"].Value

This returns True if its checked and False for uninitialized and unchecked.

Update the value in PowerShell with:

$up["ShowHide"].Value = $true
$up.Commit()
  • HI Mathew can you tell how we can change the privacy value of property using powershell.. – Anil Sep 14 '13 at 11:20
  • Does that work for you? If so can you vote me up? – Matthew McDermott Sep 17 '13 at 12:36
  • When I try this, I get the following error: New-Object : Exception calling ".ctor" with "1" argument(s): "UserProfileApplicationNotAvailableException_Logging :: UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does not have 1e6a4921-c04c-4383-b0ba-dc4d0eda093d" At line:1 char:7 + $upm =New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) What am I missing? – William Nov 18 '14 at 18:24
  • Do you have permission to use the User Profile Service? – Matthew McDermott Nov 19 '14 at 13:49
  • Alternate syntax for updating: $up.ShowHide = $true; $up.Commit() – Underverse Jan 17 '18 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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