0

Trying to remove or hide the sync icon from all sites on our SharePoint online 365 I can only find remove sync icon for site or only libraries area. We don't what to have the sync icon for any site or newly created site inside our SharePoint Farm / Online SharePoint 365 Wish to go above the Site level and disable all Site perm

1 Answer 1

0

There is no direct tenant settings to remove Sync icon from all sites or newly created site.

PowerShell to Remove Sync Button in all sites of one Site Collection(you need to look through all site collections to meet your requirement):

#Load SharePoint CSOM Assemblies
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"

Function Disable-SPOSyncButton([String]$SiteURL)
{ 
    Try{
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Credentials
 
        #Get the Web and Sub Sites
        $Web = $Ctx.Web
        $Ctx.Load($Web)
        $Ctx.Load($Web.Webs)
        $Ctx.ExecuteQuery()
 
        $Web.ExcludeFromOfflineClient=$true
        $Web.Update()
        $Ctx.ExecuteQuery()
        Write-Host -f Green "Sync Button is Disabled for the Site:" $($SiteURL)
 
        #Iterate through each subsite of the current web
        ForEach ($Subweb in $Ctx.Web.Webs)
        {
            #Call the function recursively
            Disable-SPOSyncButton -SiteURL $Subweb.url
        }
    }
    Catch {
        write-host -f Red "Error Disabling Sync Button!" $_.Exception.Message
    }
}
 
#Set parameter values
$SiteURL="https://crescent.sharepoint.com/"
 
#Get Credentials to connect
$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
 
#Call the function
Disable-SPOSyncButton -SiteURL $SiteURL

If you want powershell to run in a planned way, use the Azure Automation to schedule a PowerShell script:

https://www.sharepointdiary.com/2020/11/sharepoint-online-schedule-powershell-script-using-azure-automation.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.