Follow the steps to create new SharePoint List Item using SharePoint 2010 Management Shell (PowerShell):
1.
Open
SharePoint 2010 Management Shell with Run as Administrator
2.
Modify
and execute following script:
#Web
absolute URL where list exists
$webURL
= "<http://site:port/site/subsite>"
#SPList
Name where items to be added
$listName
= "<List Name>"
#Get
the SPWeb object and save it to a variable
$web
= Get-SPWeb $webURL
#Get
the SPList object to retrieve the List
$list
= $web.Lists[$listName]
#Create
a new item
$newItem
= $list.Items.Add()
#Add
properties to this list item
$newItem["Title"]
= "Title Text"
$newItem["Description"]
= "Description Text"
#Update
the object so it gets saved to the list
1 comment:
Worked for me...thanks
Post a Comment