How to update Person/Group Field in SharePoint 2013/2016 using Powershell?

Hello Sharepointers,

In this blog, I will give you the list of steps to update person/group field in a SharePoint document library using Powershell in SharePoint 2013/2016.

$web = get-spweb https://mysite/mytest
$groups = $web.Groups
$customGroupName = $groups[“YourGroupname”]

foreach($list in $web.Lists)
{
if($list.BaseType -eq “DocumentLibrary”)
{
$listitems = $list.Items
foreach ($item in $listitems)
{
if($item.File.CheckOutType -eq “None”){
$item.File.CheckOut()
$item[“Document Approver”]= $customGroupName
$item.Update()
$item.File.CheckIn(“”)

}
}
}

Happy SharePointing 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *