Share via


SharePoint Online SPOMod: New-SPOListItem

This article describes a function of a custom SharePoint Online module available for download and installation at GitHub.

New-SPOListItem

Creates a list item

Parameters

ListTitle  Mandatory  Name of the list 
ItemTitle  Mandatory  Title of the item 
FolderUrl  Optional  Folder to which an item should be added. Should use the following format: /sites/NameOfTheSiteColl/Lists/NameOftheList/FolderName  (Parameter available in September 2017 update) 
AdditionalField  Optional  Name of the additional property apart from the title to be defined 
AdditionalValue  Optional  Value of the additional property apart from the title  
AdditionalMultipleFields  Optional  Array of attributes. For usage, see examples below  

 

Examples

----- EXAMPLE 1 ------
Add an item to the list

new-spolistitem -ListTitle MyList6 -ItemTitle "Invoice no5"

----- EXAMPLE 2 ------
Add multiple items to the list for test purposes

for($i=0;$i -lt 100; $i++){New-SPOListItem -ListTitle MyList1 -ItemTitle ("SomeItem no"+$i)}

----- EXAMPLE 3 ------
Add item and its property

New-SPOListItem -ListTitle Mylist6 -ItemTitle "Tittulik testowy"  -AdditionalField "CSTColumn"  -AdditionalValue Prooro

----- EXAMPLE 4 ------
Add item and define multiple properties

$fields= @(@{"fieldname"="CSTColumn";"fieldvalue"="Atest"},@{"fieldname"="_x0043_ol2";"fieldvalue"="AA45AA"})
New-SPOListItem -ListTitle MyList6 -ItemTitle "Multiple Fields"  -AdditionalMultipleFields $fields

----- EXAMPLE 5 ------
Add an item to a specific folder in a list

New-SPOListItem  -ListTitle testitems -ItemTitle "Test Item title"  -FolderUrl "/sites/testSite/Lists/testitems/folder1"

See Also

SPOMod Cmdlets and Resources 
Connect-SPOCSOM
Get-SPOList
New-SPOList

PowershellScripts @ GitHub