Thursday 13 August 2015

powershell script to add new list item

powershell script to add new item-
$spWeb = Get-SPWeb -Identity http://url
$spList = $spWeb.Lists["Listname"]

#Create a new item
$newItem = $spList.Items.Add()

#Add properties to this list item
$newItem["Title"] = "test"
$newItem["Value"] = "0"

#Update the object so it gets saved to the list
$newItem.Update()

No comments:

Post a Comment