Forum Discussion

Khalid Hajjouji's avatar
Khalid Hajjouji
Copper Contributor
Dec 24, 2018

How to disable offline sync on site collection level in powershell clientside?

I now it is possible to enable/disable the offline sync option on list or site level. But I would like to this in powershell clientside. For example by Office Dev PnP. I have full controll access to all sitecollections, but have no access to the SharePoint servers. Is this possible?

 

I try something like this, but it doesnt work:

 

Connect-PnPOnline -Url "https://intranet.com"

$web = Get-PnPWeb

web.ExcludeFromOfflineClient = $false

  • Yes its possible you can loop through each site in each site collection. On each site loop through each list and set this parameter:

    $list.ExcludeFromOfflineClient = true;
    Full example:

    $site = Get-SPSite <your site collection url>
    foreach ($web in $site.AllWebs)
    {
    write-host "Site: $web"
    foreach($list in $web.lists){
    $list.ExcludeFromOfflineClient = true
    $list.update();
    }
    }
    $site.dispose()

    Let me know

Resources