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

%3CLINGO-SUB%20id%3D%22lingo-sub-306187%22%20slang%3D%22en-US%22%3EHow%20to%20disable%20offline%20sync%20on%20site%20collection%20level%20in%20powershell%20clientside%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-306187%22%20slang%3D%22en-US%22%3E%3CP%3EI%20now%20it%20is%20possible%20to%20enable%2Fdisable%20the%20offline%20sync%20option%20on%20list%20or%20site%20level.%20But%20I%20would%20like%20to%20this%20in%20powershell%20clientside.%20For%20example%20by%20Office%20Dev%20PnP.%20I%20have%20full%20controll%20access%20to%20all%20sitecollections%2C%20but%20have%20no%20access%20to%20the%20SharePoint%20servers.%20Is%20this%20possible%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20try%20something%20like%20this%2C%20but%20it%20doesnt%20work%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EConnect-PnPOnline%20-Url%20%22%3CA%20href%3D%22https%3A%2F%2Fintranet.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fintranet.com%3C%2FA%3E%22%3C%2FP%3E%3CP%3E%24web%20%3D%20Get-PnPWeb%3C%2FP%3E%3CP%3Eweb.ExcludeFromOfflineClient%20%3D%20%24false%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-306698%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20disable%20offline%20sync%20on%20site%20collection%20level%20in%20powershell%20clientside%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-306698%22%20slang%3D%22en-US%22%3EYes%20its%20possible%20you%20can%20loop%20through%20each%20site%20in%20each%20site%20collection.%20On%20each%20site%20loop%20through%20each%20list%20and%20set%20this%20parameter%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%24list.ExcludeFromOfflineClient%20%3D%20true%3B%3CBR%20%2F%3EFull%20example%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%24site%20%3D%20Get-SPSite%20%3CYOUR%20site%3D%22%22%20collection%3D%22%22%20url%3D%22%22%3E%3CBR%20%2F%3Eforeach%20(%24web%20in%20%24site.AllWebs)%3CBR%20%2F%3E%7B%3CBR%20%2F%3Ewrite-host%20%22Site%3A%20%24web%22%3CBR%20%2F%3Eforeach(%24list%20in%20%24web.lists)%7B%3CBR%20%2F%3E%24list.ExcludeFromOfflineClient%20%3D%20true%3CBR%20%2F%3E%24list.update()%3B%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%24site.dispose()%3CBR%20%2F%3E%3CBR%20%2F%3ELet%20me%20know%3C%2FYOUR%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional 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
Highlighted
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