Create a new list element in a list subfolder in Sharepoint via PowerShell

If you would like to create a new list item in a subfolder of a sharepoint list you can use the next sample code.

$items = $lista.items
$item = $items.add("/lists/mk/1",0, $null)
$item[„Title”]= „eheh”


The first parameter tells the system which folder should be the item placed at the second tells that the given uploaded item’s type – folder or a file.
So if the second parameter is 0 (zero) then the added item will be a normal sharepoint list item.
In case the secound attrib is 1 then the system will create a new subfolder under the folder you selected in the first parameter. At that time you should provide more information on the newly created subfolder’s name in the third parameter. So the example is in that case:

$item=$items.add("/lists/mk/1",1,"new folder")


Have fun.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s