Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How can I copy the value of one user property to another in SharePoint? We have a custom property called Supervisor which will be entered by the user and I want to copy this property into the Manager field in SharePoint, as the organizational profile is not working without the manager field. I am writing this in PowerShell but it is giving me the following error “Unable to index into an object of type Microsoft.Office.Server.UserProfiles.UserProfile.” My Code is

$consultantsupername = $userProfile["ConsultantSupervisor"]
$Managername =$userProfile["Manager"]
$userProfile["Manager"]=$userProfile["ConsultantSupervisor"] 
$userProfile.Commit()

Please help me… Thanks

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You're forgetting the .Value portion... Check out line 31 of this guy's code:

http://ghamson.wordpress.com/2010/11/04/updating-user-profile-properties-via-powershell-pictureurlsharepoint-2010-in-sp2010/

share|improve this answer
    
Thank you ..That worked beautifully .I have one more question so now i am seeing the change in the manager field but still it is not updating organizational browser .Is there something i am missing???? –  Anil Apr 23 '12 at 18:40
    
Have you synced the User Profile Service? –  RJ Cuthbertson Apr 23 '12 at 18:47
    
Yes i performed an incremental sync ..do i need to perform a full sync ?? –  Anil Apr 23 '12 at 18:51
    
I don't know what to tell you, it might be a Silverlight thing (try clearing the cache?). If that doesn't work, I'd suggest starting a new thread. –  RJ Cuthbertson Apr 23 '12 at 18:53
    
Actually it worked i think we have to wait for 10 min even afer the sync was performed thanks .,.. –  Anil Apr 23 '12 at 18:57
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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