I had a request to rename roughly 100 libraries in our SharePoint deployment recently and thought it would be a good time to dig into a bit of PowerShell.
In this post I’ll demonstrate how to loop through site collections, subsites, lists and finally how to filter and change a name of a list and I’ll also attempt to show a few interesting properties we can change.
For those of you just looking for a quick bit of code to use, this will loop through all lists excluding anything in the ‘personal’ directories and will then rename the lists as specified in the $newLibraryname variable. Feel free to use this code however you want.
Be sure to change the Variables at the top as required –
Useful List Variables
Here’s a very short list of useful variables attached to lists which can be used to update options –
- $list.ForceCheckout – Returns $True or $False depending on whether Force Check out is enabled.
- $list.EnableModeration – Returns $True or $False depending on whether ‘Require content approval for submitted items’ is enabled.
- $list.AllowDeletion – Returns $True if the list can be deleted otherwise set to false to protect a list.
- $list.EnableFolderCreation – Returns $True of $False depending on whether folders can be created.
- $list.EnableVersioning – Returns $True of $False depending on whether versioning is enabled. I plan to write another short article on configuring this properly.
Hope this helps!