Advertisement
PtiTom

Add Item in PowerShell

Dec 5th, 2014
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $weburl = "http://mysharepoint"
  2. $listname = "TestList"
  3. $a = "Text1"
  4. $b = "Text2"
  5. $c = "Text3"
  6.  
  7.  
  8. Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue
  9. $web = Get-SPWeb -Identity $webUrl
  10. $list = $web.Lists[$listname]
  11. $newItem = $list.items.add()
  12. $newitem["Title"] = $a
  13. $newitem["Custom_Column1"] = $b
  14. $newitem["Custom_Column2"] = $c
  15. $newitem.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement