Forum Discussion
Configure team sites to sync automatically to File Explorer
See: https://docs.microsoft.com/en-us/onedrive/use-group-policy#AutoMountTeamSites
I can not get this to work.
I have set up the GPO according to documentation but nothing happens, for several days.
Im following this:
https://docs.microsoft.com/en-us/onedrive/use-group-policy#configure-team-site-libraries-to-sync-automatically
Is this GPO broken?
- Jake TurnerOct 28, 2019Copper Contributor
Anders Gidlund I am no expert, but I can confirm that this does work. I was able to set it up for about 5 different o365 groups. The sync does not immediately go into effect like most policies. Every time I have done it, I had to wait till the next day to see the library sync on my test computer.
- Anders GidlundOct 28, 2019Copper Contributor
Jake Turner
Are there any problems with my formatting? Now I have ran the Powershell code according to the documentation page to fix the encoding. Is it correct that I should have these { and } around the guids?
tenantId={00000000-0000-0000-0000-000000000000}&siteId={00000000-0000-0000-0000-000000000000}&webId={00000000-0000-0000-0000-000000000000}&listId={00000000-0000-0000-0000-000000000000}&webUrl=https://example.sharepoint.com&version=1How hard is the limit of no more than 5000 files/folders in a library? Does OneDrive check and count the objects before syncing? Theres no problem syncing these libraries manually.
- Dorje-McKinnonNov 27, 2019Iron Contributor
Anders Gidlund and Jake Turner
I had a similar issue and using the work of Dale Hayter , and others I've modified his PowerShell script to give back the same ID that you get if you click Copy id, when you use the Sync button.
Here is the script so that it is easier for others to find:
My goal with this was to have a PowerShell way of creating the registry setting for hundreds of teams, so that we could give our users a good experience of having their Organisation Team site's synced to their File Explorer quickly and easily.
# source for this script # https://www.blackforce.co.uk/2019/09/12/sharepoint-copy-library-id-missing-for-team-site-libraries-sync # and # https://www.blackforce.co.uk/2019/06/07/automatically-sync-microsoft-sharepoint-team-site-libraries-now-live#comment-4601075707 # Adapted by Dorje McKinnon to add a variable for the folder, because channels in team sites are specific to folders # This script was setup to sync the General channel folder from a departmental team site #set the following four things for each SharePoint site / library / folder you want the Registry key for to auto sync with OneDrive #example of the URL I'm synching https://MyTennant.sharepoint.com/sites/MyDepartment/Shared Documents/General $siteName = 'MyDepartment' #Sharepoint site URL $docLib = 'Documents' #Sharepoint Document Library name not address $docLibUrl = 'Shared documents' #Sharepoint library URL $docLibFolder = 'General' #>>> everything below here likely stays the same everytime you run the script # info on howto get your tennant id # https://tomtalks.blog/2015/09/how-to-get-your-office-365-tenant-id/ $tenant = 'MyTennant' # the first part of your tennant name XXXXX.sharepoint.com $tenantId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' #Tenant ID, can be retrieved from Azure AD or PowerShell under optional. # Connection This didn't work with my setup but may work for you. #Connect-PnPOnline https://$tenant.sharepoint.com/sites/$siteName -SPOManagementShell # >>>> Login using an account with access to the site. # If you do not have MDA or modern auth then do not use the -SPOManagementShell switch Connect-PnPOnline https://$tenant.sharepoint.com/sites/$siteName # Convert Tenant ID $tenantId = $tenantId -replace '-','%2D' # Convert Site ID $PnPSite = Get-PnPSite -Includes Id | select id $PnPSite = $PnPSite.Id -replace '-','%2D' $PnPSite = '%7B' + $PnPSite + '%7D' # Convert Web ID $PnPWeb = Get-PnPWeb -Includes Id | select id $PnPWeb = $PnPWeb.Id -replace '-','%2D' $PnPWeb = '%7B' + $PnPWeb + '%7D' # Convert List ID $PnPList = Get-PnPList $docLib -Includes Id | select id $PnPList = $PnPList.Id -replace '-','%2D' $PnPList = '%7B' + $PnPList + '%7D' $PnPList = $PnPList.toUpper() # end product &folderId=ecc664be%2D3ca0%2D4a7b%2D8ec2%2Dd92be4bf4847 # Convert FolderID ID $foldertotest = '/sites/'+$siteName+'/'+$docLibUrl+'/'+$docLibFolder $PnPFolder = Get-PnPFolder -url $foldertotest -Includes UniqueId $PnPFolder = $PnPFolder.UniqueId -replace '-','%2D' $PnPFolder = '%7B' + $PnPList + '%7D' $PnPFolder = $PnPFolder.toUpper() # Enumerate the Full URL $FULLURL = 'tenantId=' + $tenantId + '&siteId=' + $PnPSite + '&webId=' + $PnPWeb + '&listId=' + $PnPList + '&folderId=' + $PnPFolder + '&webUrl=https%3A%2F%2F' + $tenant + '%2Esharepoint%2Ecom%2Fsites%2F' + $siteName + '&version=1' # Output the FULL URL To Copy and Paste Write-Output 'List ID: ' $FULLURL