Quantcast
Viewing all articles
Browse latest Browse all 41

SharePoint Delete Items and files directly or using recycle bin by using Powershell

When you use a Powershell Script to work on SharePoint List items or Files you can do a lot of things. One of those things for example is deleting items which are not needed anymore. Therefore you can use a Powershell function like

$listitem.Delete()

This means that the list item or file will be deleted permanently. It will not be in the SharePoint recycle bin and not in the secondary recycle bin. It is lost forever if you not have it in one of your backups.

So what if, if you would like to delete it, but put it into the recycle bin? Therefore you should not use the delete() function. In this case you should use the following

$listitem.Recycle()

This will put the item into the secondary recycle bin SharePoint offers. You can reach this one if you click on site settings and then below Site Collection Administration the link to the recycle bin

Image may be NSFW.
Clik here to view.
SC_Recyclebin

Image may be NSFW.
Clik here to view.
SC_Recyclebin2

Normally this recycle bin will be emptied after a certain period which can be configured in the central administration.

One of my questions is now – Can we put those files also into the first recycle bin for the enduser? If you know it, please let me know.

In this post there is a little explaination based on SharePoint 2007.


Viewing all articles
Browse latest Browse all 41

Trending Articles