Disable ‘Allow items from this site to be downloaded to offline clients’ in SharePoint

Sometime we need to disable the “Sync” button in SharePoint document libraries and that can be done by the following methods.

Traditional Way:

Site Settings -> Search: Search and offline availability -> Set ‘Allow items from this site to be downloaded to offline clients?’ to “No”

Programmatic way using PnP Powershell:

try {
    $web = Get-PnPWeb -Includes ExcludeFromOfflineClient
    Write-Host "Setting options to disable 'Allow items from this site to be downloaded to offline clients'..."
    $web.ExcludeFromOfflineClient = $true        
    $web.Update()
    Invoke-PnPQuery
    Write-Host "Completed."
}
catch {
    $ErrorMessage = $_.Exception.Message
    Write-Host "Error disabling offline clients. $ErrorMessage"
}

Leave a Reply

Your email address will not be published / Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.