Is it possible to iterate through all the lists in a site collections and create a folder name "Test" using PowerShell?
Fine Regards
Should be something like:
# get the site collection
$s = get-spsite http://siteurl
# loop through all site in the site collection,
# then through all lists / libraries in that site (filtering out everything but actual doc libs
# (The catalog filter excludes all sharepoint libs like the masterpage catalog etc.
// for each list, add a folder called test to the rootfolder
$s.AllWebs | Foreach-Object {
$_.Lists | Where { ($_.BaseType -eq "DocumentLibrary") -and ($_.BaseTemplate -notmatch "Catalog") } | Foreach-Object {
$_.RootFolder.SubFolders.Add("Test")
$_.Update()
}
}
# P.S.
# not sure if you need to call the list's update method after adding the folder
# to show folder info, change $_.RootFolder.SubFolders.Add("Test") into
#Write-Host ($_.Title + " - " + $_.BaseType + " - " + $_.BaseTemplate )