Friday, June 4, 2021

Updating SharePoint UserProfile Properties

In case the SharePoint user profile property for a specific user or set of users then you can use the below powershell script to update the user profile property directly from sharepoint. 

$web=get-spweb -identity http://<weburl>


$user=$web.EnsureUser("<staffid with domain- user claims>")


$user | fl     -- this will show the user id and pass that id to below script in GetitembyID method


$web=get-spweb -identity  http://<weburl>


$list=$web.lists["user information list"]


$item=$list.GetItemById(6007) 


$item["JobTitle"]="<Title to update>"

$item["Department"]="<New Dept>"


$item.Update()


$list.Update()


$web.Update() 

No comments:

Post a Comment