Sync options enables a site content to be available offline, users can sync documents using from a SharePoint Document Library using OneDrive sync client on their local drives to use them offline and can also add content and changes to it which will be uploaded when connected online.
There are requirements for some specific content where site administrators require to disable document syncing on some of the document libraries (check this this blog post to learn about enabling and disabling sync on a document library). And there could also be requirements where site administrator require to disable offline availability of all content from a site.
I will be sharing two different ways for achieving this job by enabling/disabling from site settings and PowerShell. PowerShell option would be very helpful if you trying to disable sync on multiple sites or for all sub sites under a site or site collection.
Follow the below steps to enable / disable sync button for a document library
- Got to site settings
- Click on “Search and Offline availability option” listed under “Search”
- Select “Yes” or “No” option for “Offline Client Availability” (check screenshot at top)
- Save changes
This will disable the sync option from all document libraries in the site, you verify that be visiting any of the document library under that site.
I am sharing a PowerShell script which could be helpful enabling or disabling sync at the site level. The EnableDisableSiteSync function takes two parameters site url and action, if you need to run disable or enable all sub sites under the given URL then you can iterate through all sub sites and perform the required action.
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Fuction to enable or disable sync in a document library
function EnableDisableSiteSync ($siteURL, $action)
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($cred.Username, $cred.Password)
$ctx.Credentials = $credentials
#$ctx.Load($web.Webs) ##uncomment this if you need to run for all subsites under this site
#if you want run the script for all subsites under this site then follow run below cmdlets
#foreach ($subsite in $web.Webs)
Write-Host -ForegroundColor Red $_.Exception.ToString()
EnableDisableSiteSync -siteURL "https://mstalk.sharepoint.com" -action "True"
Latest posts by Adnan Amin (see all)
- Five ways to get OneDrive URL for a User in Microsoft 365 - March 1, 2020
- OneDrive Sync issue: SharePoint Documents Library not syncing - February 12, 2020
- Teamwork in Microsoft 365 - September 18, 2019