Friday, 26 October 2012

Import CSV(excel) file to SharePoint list

Here the import the more than documents to add the lists using the Power Shell  Commands.

1.we have to add the title of the list  and body of contents and expire date.its like this

and save as .csv format.

2.After that using this code in Notepad



Add-PsSnapin Microsoft.SharePoint.Powershell –ErrorAction SilentlyContinue
$csv = Import-Csv 'csv file path'

$web = Get-SPWeb -identity "Domin Name"

$list = $web.Lists["ListName"]

foreach ($row in $csv) {
$item = $list.Items.Add();
$item["Title"] =$row.Title
$item["Body"] =$row.Body
$item["Expires"] =$row.Expires
$item.Update()
}
Write-Host "Finished! Press enter key to exit." -ForegroundColor Green
Read-Host


and save as filename.ps1 format.
3.finally exect that file

Automatically created the contents on the particular list.


No comments:

Post a Comment

KendoUI Chart using in AngularJS with Dynamic data

Here i'm going to do the KendoUI Chart using AngularJS  and getting dynamic data from angular services. First need to down-lode the r...