How to Add New List Item in SharePoint using PowerShell?

Requirement: Add a list item in SharePoint using PowerShell

Add SharePoint list items using PowerShell

Are you looking for a way to add a list item in SharePoint using PowerShell? Well, in this article, we will show you how to add an item to a specific list in your SharePoint site using PowerShell. We will also provide some examples of how to make the process as easy as possible.

Here are my PowerShell scripts to add list item in SharePoint! The syntax to add a new list item in SharePoint using PowerShell goes like this:

#Get Web and List Objects
$Web = Get-SPWeb "https://sharepointsite.com"
$List = $Web.Lists["ListName"]

#Create a new item
$NewItem = $List.AddItem()
 
#Set Column values
$NewItem["ColumnName"] = "Field Value goes here!"
 
#Update the Item, so that it gets saved to the list
$NewItem.Update()

Add list item in SharePoint with PowerShell

Let’s add a new task to the task list using PowerShell: 

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Processing Variables
$WebURL="https://sharepoint.crescent.com"
$ListName="Tasks"

#Get Web and List Objects
$Web = Get-SPWeb $WebURL
$TaskList = $Web.Lists[$ListName]

#Create New Task Item
$NewTask = $TaskList.AddItem()
$NewTask["Title"] = "Migration Project - SOW"

#Add Date Time values
$NewTask["StartDate"] ="02/22/2015 00:00:00"
$NewTask["DueDate"] = "02/25/2015 02:00:00 PM"

#Add Assigned to People Picker field
$NewTask["AssignedTo"] = $Web.EnsureUser("Crescent\Salaudeen")

$NewTask.Update()

Result:
add sharepoint list items using powershell
Here is my another article to create new list items in SharePoint Online using PowerShell: Add Item to SharePoint Online List using PowerShell

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply