Thursday, January 10, 2019

PowerShell: Remove Items & Document Sets from Library

Here are the basics of the script:
- Get your web
- Get your list, you can also use a foreach and iterate through every list
- From the list get your root folder
- The root folder has multiple sub folders, which are the document sets
- Iterate through each document set / sub folder and delete the items
- Delete the sub folder
- Move to the next sub folder
- Important to note: I excluded the "Forms" folder, because you can't delete that
I just threw this together in a couple of minutes, so expect errors. I'm also redoing the whole "foreach" thing, because I'm changing the collection with every delete.

No comments:

Post a Comment