Adding SharePoint List Items with Powershell

From Secrets of SharePoint – Tip of the Day

SharePoint 2010 offers over 500 new cmdlets that we can use to automate the SharePoint 2010 environment through Windows PowerShell. The cmdlets go as deep as SPWeb, everything beyond SPWeb requires additional scripting, such as adding fields, views and items. Here’s an example showing how to add an item to the Announcements list in SharePoint 2010:

In the example we use the Get-SPWeb cmdlet to bind to a specific site. Next we use the GetList() method to retrieve a list. The method accepts a lists relative URL as input. We then use the AddItem() method to create a new item in SharePoint 2010. Finally we use the Dispose() method on the SPWeb object to make sure that the object is disposed of correctly.

This entry was posted in SharePoint and tagged by Rick Backus. Bookmark the permalink.

About Rick Backus

A technology consultant with over 25 years of IT, consulting and business technology industry experience. Specializing in integrating application, information and content management with business process and network infrastructure. Helping clients get the most out of technology to enable increased productivity, profitability, customer satisfaction and competitive advantage.