0176253552
KeriaCoder
  • Welcome
  • About
  • Blog
  • Contact
  • Search
[Keriacoder] - Powershell

[Powershell] – Import to Sharepoint List from CSV

08/22/2015/0 Comments/in Tutorial /by fahmi

Import to Sharepoint List from CSV
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Add-PSSnapin Microsoft.SharePoint.PowerShell
}
# define web application where list is located
$web = Get-SPWeb http://contoso/
$list = $web.lists["List Name"]
$cnt = 0
# define csv document path
foreach($i in Import-CSV 'E:\Scripts\Excel\ImportFromCSV.csv')
{
$new = $list.Items.Add()
$new[“Title”] = $i.'Title'
$new.Update()
$cnt++
}
"Added " + $cnt.ToString() + " records."
"Data successfully imported. Press any key to continue…"
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

Please take note that this code must be run on the same server where the web application is with authenticated privilege. 

Tags: powershell, powershell scripting, sharepoint, sharepoint 2007, sharepoint 2010, sharepoint 2013
Share this entry
  • Share on Facebook
  • Share on Twitter
  • Share on Google+
  • Share on Pinterest
  • Share on Linkedin
  • Share on Reddit
  • Share by Mail
You might also like
Cannot Complete This Action as the Secure Store Shared Service is not Responding
Sharepoint : Get Error Details from Correlation ID via Powershell
Simple way to move content database of SharePoint 2010
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

You must be logged in to post a comment.

KeriaCoder View Stat

Recent Posts

  • Disable Loopback Check
  • How To – Allow non-admins to start and stop system services
  • How to add new hostfile Tutorial
  • [Powershell] – Import to Sharepoint List from CSV
  • Simple way to move content database of SharePoint 2010

Recent Comments

    Archives

    • January 2016
    • September 2015
    • August 2015
    • July 2015
    • June 2015

    Categories

    • Troubleshoot
    • Tutorial

    Latest Update

    • Disable Loopback Check01/26/2016 - 2:50 am
    • How To – Allow non-admins to start and stop system services01/05/2016 - 1:50 am

    Recent Comments

      Categories

      • Troubleshoot
      • Tutorial

      Archives

      Keria Coder (00208351-W)

      No 4a, Jalan Keluli Aj7/Aj,
      Taman Perindustrian Bukit Raja Selatan,
      40000 Shah Alam

      +60-0176253552
      fahmi@keriacoder.com

      © Copyright - KeriaCoder 2015 - Enfold WordPress Theme by Kriesi
        Simple way to move content database of SharePoint 2010 How to add new hostfile Tutorial
        Scroll to top