-
-
Save ITProCorner/b0521c9f5420442f3a4c685dec273ca5 to your computer and use it in GitHub Desktop.
PS + CSOM to iterate webs, starting from the ClientContext web..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. .\TopOfScript.ps1 | |
$rootWeb = $clientContext.Web | |
$childWebs = $rootWeb.Webs | |
$clientContext.Load($rootWeb) | |
$clientContext.Load($childWebs) | |
$clientContext.ExecuteQuery() | |
function processWeb($web) | |
{ | |
$lists = $web.Lists | |
$clientContext.Load($web) | |
$clientContext.ExecuteQuery() | |
Write-Host "Web URL is" $web.Url | |
} | |
foreach ($childWeb in $childWebs) | |
{ | |
processWeb($childWeb) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment