Friday, July 24, 2020

powershell update Peoplepicker in List In SHarePoint

#Read the CSV file 
#stored local variable 
$delimitercsv = "|" 
$filePath = "C:\peakfinders.csv" 
$userid = "EmpID"
$useremailowner = "Owner"

#Get the SharePoint List
$tWeb = Get-SPWeb -identity "http://sharepoint.peakfinders.com" 
$list = $tWeb.Lists["Employee"]
$CSVData = Import-CSV -path $filepath | ForEach-Object {
    Write-Host "$($_.ID) ,$($_.'Email-Address')";
foreach($sitem in $items)
{

$userid = $sitem['EmpID']
if($userid.LookUPid -eq $($_.ID)){
$sitem["mail"] =$($_.'Email-Address');
$sitem.Update()
}
}
}

1 comment: