1.Click "Start" button
2.Choose the "Microsoft SharePoint 2010 Products"
3.Click the "SharePoint 2010 Management Shell" [ run as Administrator ]
Script
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Read the CSV file - Map the Columns to Named Header (CSV File doesn't has Column Header)
$CSVData = Import-CSV -path "C:\Data.csv" -Header("Title", "Description")
#Get the Web
$web = Get-SPWeb -identity "Site Collection URL"
#Get the Target List
$list = $web.Lists["List Name"]
#Iterate through each Row in the CSV
foreach ($row in $CSVData)
{
$item = $list.Items.Add();
$item["Title"] = $row.Title
$item["Description"] = $row.Description
$item.Update()
}
2.Choose the "Microsoft SharePoint 2010 Products"
3.Click the "SharePoint 2010 Management Shell" [ run as Administrator ]
Script
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Read the CSV file - Map the Columns to Named Header (CSV File doesn't has Column Header)
$CSVData = Import-CSV -path "C:\Data.csv" -Header("Title", "Description")
#Get the Web
$web = Get-SPWeb -identity "Site Collection URL"
#Get the Target List
$list = $web.Lists["List Name"]
#Iterate through each Row in the CSV
foreach ($row in $CSVData)
{
$item = $list.Items.Add();
$item["Title"] = $row.Title
$item["Description"] = $row.Description
$item.Update()
}
No comments:
Post a Comment