Issue: When we create a list using import a spreadsheet and if you have an people and group field in the spreadsheet, after import the people and group field may change as single line of text field.
Workaround: Create a people and group field in the same list where you have imported the list.Following PowerShell script will read the values from single line of text field and update in the value in people and group field. Make sure your AD user profile is similar to the source list/site.
Workaround: Create a people and group field in the same list where you have imported the list.Following PowerShell script will read the values from single line of text field and update in the value in people and group field. Make sure your AD user profile is similar to the source list/site.
Add-PSSnapin
Microsoft.Sharepoint.Powershell
[System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site = new-object
Microsoft.SharePoint.SPSite("SiteURL”)
$web =
Get-SPWeb -Identity siteURL
$lista
=$web.Lists["ListName"]
$items =
$lista.items
foreach ($item in
$items) {
$user =
$item["SingleTextColumnNameOfUserName"]
write-host
$useracc
$useracc =
$web.EnsureUser( $user);
$item["NewPeople&GroupFieldName"] = $useracc
write-host $useracc
$item.update()
}
$lista.update()