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

Copper Contributor

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

1 Reply
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