Sync multiple sites to explorer via PowerShell
Prepare CSV
Create CSV with these columns. This information is needed to start the Sync Process (HTTP-Call on odopen://, see in PowerShell script) along with the UsersID and UsersUPN.
Column (Property) | Example | How to get value |
url |
Export from SharePoint Admincenter |
|
siteid |
39r18c7a-11a1-5acf-813e-784339a741de |
Export from SharePoint Admincenter |
webid |
61b9a58e-30e1-4069-9417-843a0938a6a1 |
Always the same (static) |
listid |
0b947fb2-6cde-4be2-a801-61a7642a5186 |
Always the same (static) |
sitename |
Team Site 1234 |
Export from SharePoint Admincenter Attention: This has to be UTF-7 encoded (no ä, ö, ü, é, è, etc. included). |
Copy template here.
url;siteid;webid;listid;sitename
https://lucanoahcaprez.sharepoint.com/sites/teamsite1234;39r18c7a-11a1-5acf-813e-784339a741de;61b9a58e-30e1-4069-9417-843a0938a6a1;0b947fb2-6cde-4be2-a801-61a7642a5186;Team Site 1234
Run script on client
This script can be run on the client to sync the provided sites in the csv.
$SiteList = Import-Csv -Delimiter ";" -Path "C:\LocalData\MultipleSiteSync.csv"
$userid = "<userid>"
$userEmail = "<userupn>"
Foreach($Site in $SiteList){
$SiteId = $Site.siteid
$WebId = $Site.webid
$Listid = $Site.listid
$WebTitle = $Site.sitename
$WebUrl = $Site.url
Start-Process "odopen://sync?userId=$userid&userEmail=$UserEmail&isSiteAdmin=0&siteId=$SiteId&webId=$WebId&webTitle=$WebTitle&webTemplate=64&webUrl=$WebUrl&onPrem=0&libraryType=3&listId=$ListId&listTitle=Dokumente&scope=OPENLIST"
Start-Sleep -seconds 10
}
No Comments