In the Modern Workplace, it is quite common for users to sync their Microsoft Teams Document libraries to their devices using the OneDrive client. However, this has always had to be initiated by the end user.
Last year, Microsoft announced that they would be adding the facility to enable admins to force users to automatically sync certain Team Site libraries. Having the ability to automatically setup the sync of common Team Sites to a group of users is a great addition as it would save a lot of helpdesk calls and cut down on a lot of administrative overhead. Its the final piece of the puzzle we have all been waiting for in a true AutoPilot world. A user can finally get a device, provision it with AutoPilot and then their own personal OneDrive will automatically sync, then their common Team Sites automatically setup. Beautiful!!!
Lets have a go and see it in action. Here’s how to set it up for a single device. If you want to deploy to masses you can use Group Policy or push out via Intune. In this example I am going to use Local Group Policy to do it.
First of all, in order to use this feature, the device needs to be running Windows 10 1709 or later (AutoPilot wont work with this ver, but lets ignore this). In my test I am running 1903. The user also needs to be running a build of OneDrive 19.086.0502.0006 or later. This version is slowly being rolled out to users.
To force a manual update, go to %localappdata%\Microsoft\OneDrive and run OneDriveStandaloneUpdater.exe. It will then download the latest version available to that user. Once we have the required versions of all the prerequistes we can carry on.
To setup the sync we also need to get the sync URL for the library that we want to sync. As an admin, go to the SharePoint Library in Internet Explorer and click sync.
You will notice a new option on the popup box. Click Copy library ID. We need this ID to setup the sync.
Its a massive URL like below. Save it to notepad or something. We will need it later.
tenantId=1111111f%222222f%3333333%444444%5555555db44&siteId=%7B2eceef1b%5555555%2D4bbd%2Db52f%2Db9499b356b4b%7D&webId=%7B2d8b1da4%7777779%2D47bf%2D89a6%2D4e424184b384%7D&listId=%7B7009F388%2D9566%2D4AB4%2DBDCA%2DEB83CE1A99C8%7D&folderId=f88b3b9a%2D0feb%2D4256%2D9870%2Dd8f89ef5f2bb&webUrl=https%3A%2F%2FCompany%2Esharepoint%2Ecom%2Fsites%2FIntranet&version=1
Now we have the library we want to sync lets crack on with the client side and the group policy setting. Go to %localappdata%\Microsoft\OneDrive. In the folder you will notice there is a folder labelled with the OneDrive client version number.
Go into the folder and then adm. These are the new OneDrive Group Policy ADM files that need to be added to PolicyDefinitions on the device. Copy the contents of this folder to C:\Windows\PolicyDefinitions. Copy the OneDrive.adml file into the en-us folder within it. If you now open gpedit.msc on the device you will see the new OneDrive Group Policy Settings. One under device and one under User.
I am going to put the options under User. You can put the option under device if you wanted to apply it to all users who login to it. Click OneDrive under user configuration and then administrative templates. Then double click “Configure team site libraries to sync automatically”.
Put it a friendly name for the library in Value Name and then enter the Library ID in the Value field.
When the user next logs in to OneDrive the library will automatically sync within 8 hours. Not sure why it takes so long but this is the timeframe that Microsoft quote. In my experience it takes around 30 – 45 mins on my little library.
In Microsoft’s official documentation on the feature it warns:
Do not enable this setting for libraries with more than 5,000 files or folders. Do not enable this setting for the same library to more than 1,000 devices.
I am not sure why this is the case. They say elsewhere that libraries with upto 100,000 items can be synced. Hmmmm not too sure why. Hope Microsoft will clarify at some point.