# Import the .csv file, and specify manually the headers, without column name in the file
$contents = Import-CSV ‘C:\Input.csv' -header("Employee ID", "Employee Name")
# Web URL
$webURL = “SITEURL here”
$web = Get-SPWeb -Identity $webURL
$listName = "ListNameHere"
$list= $web.Lists["$listName"]
# Iterate for each list column
foreach ($row in $contents )
{
$item = $list.Items.Add();
$item["Employee ID"] = $row.GroupName
$item["Employee Name"] = $row.Permissions
$item.Update()
}
Write-Host -ForegroundColor green "List Updated Successfully"
$web.Dispose()
No comments:
Post a Comment