Script to mass disable sync for Office 365 Groups

%3CLINGO-SUB%20id%3D%22lingo-sub-42211%22%20slang%3D%22en-US%22%3EScript%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42211%22%20slang%3D%22en-US%22%3E%3CP%3EA%20customer%20of%20mine%20wants%20to%20disable%20sync%20for%20all%20Groups%20doclibs.%3C%2FP%3E%3CP%3EAFAIK%20there%20is%20not%20a%20global%20setting%20for%20this.%3C%2FP%3E%3CP%3EI%20know%20that%20it%20is%20possible%20to%20do%20it%20manually%20for%20every%20single%20doclib%20in%20the%20advanced%20library%20settings%2C%20but%20such%20approach%20is%20impractical%20for%20hundreds%20of%20Groups.%3C%2FP%3E%3CP%3ECan%20someone%20point%20me%20to%20an%20existing%20script%20for%20doing%20it%20for%20all%20Groups%20in%20a%20tenant%3F%3C%2FP%3E%3CP%3ETIA.%3C%2FP%3E%3CP%3Ecc%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F60%22%20target%3D%22_blank%22%3E%40Juan%20Carlos%20Gonz%C3%A1lez%20Mart%C3%ADn%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1547%22%20target%3D%22_blank%22%3E%40Santhosh%20Balakrishnan%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-42211%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%20Groups%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-129010%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-129010%22%20slang%3D%22en-US%22%3E%3CP%3Ethis%20script%20works%20very%20well%20for%20existing%20groups.%20But%20is%20it%20also%20possible%20to%20disable%20syncronization%20when%20creating%20a%20group%3F%20Otherwise%20you%20always%20have%20to%20switch%20something%20off%20afterwards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44478%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44478%22%20slang%3D%22en-US%22%3E%3CP%3EThankyou%20so%20much%20Drew.%20This%20was%20spot%20on%20what%20i%20was%20looking%20for.%20Saved%20my%20day.%20Again%2C%20thanks%20a%20lot.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44241%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44241%22%20slang%3D%22en-US%22%3E%3CP%3EI%20took%20a%20stab%20at%20this%20using%20the%20scripts%20already%20created%20by%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F60%22%20target%3D%22_blank%22%3E%40Juan%20Carlos%20Gonz%C3%A1lez%20Mart%C3%ADn%3C%2FA%3E%26nbsp%3Band%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F637%22%20target%3D%22_blank%22%3E%40Brent%20Ellis%3C%2FA%3E%26nbsp%3Balong%20with%20the%20site%20iteration%20scripts%20%3CA%20href%3D%22http%3A%2F%2Fwww.sharepointnutsandbolts.com%2F2013%2F12%2FUsing-CSOM-in-PowerShell-scripts-with-Office365.html%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20%26nbsp%3BThis%20will%20set%20the%20Offline%20Client%20Availability%20at%20the%20web%20level%20initially%20for%20the%20site%20you%20enter%20and%20give%20you%20the%20option%20to%20do%20all%20subsites%20(I%20edited%20the%20original%20to%20include%20all%20levels%20of%20subsites%20based%20on%20this%20super%20handy%20script%20%3CA%20href%3D%22http%3A%2F%2Fwww.tonyishere.co.uk%2Fnews%2Flooping-through-all-subsites-in-sharepoint-online%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%26nbsp%3Band%20not%20just%20level%201).%20%26nbsp%3BI%20tested%20this%20on%20Group%20and%20Classic%20sites.%20%26nbsp%3BIt%20certainly%20could%20be%20cleaned%20up%20a%20bit%20and%20be%20enhanced%20to%20support%20things%20like%20.csv%20input%20and%20probably%20overall%20more%20optimized.%20%26nbsp%3B%3C%2FP%3E%3CPRE%3EAdd-Type%20-Path%20%22C%3A%5Ctemp%5Cmicrosoft.sharepointonline.csom.16.1.6008.1200%5Clib%5Cnet45%5CMicrosoft.SharePoint.Client.dll%22%0AAdd-Type%20-Path%20%22C%3A%5Ctemp%5Cmicrosoft.sharepointonline.csom.16.1.6008.1200%5Clib%5Cnet45%5CMicrosoft.SharePoint.Client.runtime.dll%22%0A%0A%24siteUrl%20%3D%20Read-Host%20-Prompt%20%22Enter%20Site%20Collection%20URL%22%0A%24username%20%3D%20Read-Host%20-Prompt%20%E2%80%9CEnter%20username%E2%80%9D%0A%24password%20%3D%20Read-Host%20-Prompt%20%E2%80%9CEnter%20password%E2%80%9D%20-AsSecureString%0A%24subwebcheck%20%3D%20Read-Host%20-Prompt%20%22Do%20you%20want%20to%20process%20subsites%3F%20(Y%2FN)%22%0A%0A%23%20Generate%20ClientContext%20function%20so%20we%20can%20reuse%0Afunction%20GetClientContext(%24siteurl%2C%20%24username%2C%20%24password)%20%7B%0A%20%20%20%20%20%24ctx%20%3D%20New-Object%20Microsoft.SharePoint.Client.ClientContext(%24siteurl)%20%0A%20%20%20%20%20%24credentials%20%3D%20New-Object%20Microsoft.SharePoint.Client.SharePointOnlineCredentials(%24username%2C%20%24password)%20%0A%20%20%20%20%20%24ctx.Credentials%20%3D%20%24credentials%0A%20%20%20%20%20return%20%24ctx%0A%7D%0A%0A%24ctx%20%3D%20GetClientContext%20%24siteurl%20%24username%20%24password%0A%0Aif%20(%24ctx.ServerObjectIsNull.Value)%20%7B%20%0A%20%20%20%20Write-Host%20%22Unable%20to%20connect%20to%3A%20'%24siteUrl'%22%20-ForegroundColor%20Red%0A%7D%20else%20%7B%0A%20%20%20%20Write-Host%20%22Connected%20to%3A%20'%24(%24siteUrl)'%22%20-ForegroundColor%20Green%20%0A%0A%20%20%20%20%24rootWeb%20%3D%20%24ctx.Web%0A%20%20%20%20%24ctx.Load(%24rootWeb)%0A%20%20%20%20%24ctx.ExecuteQuery()%0A%0A%20%20%20%20%23%20update%20root%20site%0A%20%20%20%20Write-Host%20%24rootWeb.Url%20%22is%20being%20updated%20to%20exclude%20from%20offline%20clients%22%0A%20%20%20%20%24rootWeb.ExcludeFromOfflineClient%3D%24true%0A%20%20%20%20%24rootWeb.Update()%0A%20%20%20%20%24ctx.Load(%24rootWeb)%0A%20%20%20%20%24ctx.ExecuteQuery()%0A%20%20%20%20Write-Host%20%22ExcludeFromOfflineClient%20is%20now%22%20%24rootWeb.ExcludeFromOfflineClient%20%22for%20the%20site%3A%22%20%24rootWeb.Url%20-ForegroundColor%20Green%0A%20%20%20%20%20%20%20%0A%20%20%20%20if%20(%24subwebcheck%20-eq%20%22Y%22)%20%7B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%23%20work%20with%20subsites%0A%20%20%20%20%20%20%20%20Write-Host%20%22Processing%20subsites...%22%20-ForegroundColor%20Yellow%0A%20%20%20%20%20%20%20%20%24childWebs%20%3D%20%24rootWeb.Webs%0A%20%20%20%20%20%20%20%20%24ctx.Load(%24childWebs)%0A%20%20%20%20%20%20%20%20%24ctx.ExecuteQuery()%0A%20%20%20%20%20%20%20%20foreach%20(%24childWeb%20in%20%24childWebs)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20processsubsites%20%24childWeb.url%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%0A%20%20%20%20%23%20function%20to%20loop%20through%20subsites%20and%20setting%20values%0A%20%20%20%20function%20processsubsites%20(%24siteurl)%7B%0A%20%20%20%20%20%20%20%20%24ctx%20%3D%20GetClientContext%20%24siteurl%20%24username%20%24password%0A%20%20%20%20%20%20%20%20%24rootWeb%20%3D%20%24ctx.Web%0A%20%20%20%20%20%20%20%20%24childWebs%20%3D%20%24rootWeb.Webs%0A%20%20%20%20%20%20%20%20%24ctx.Load(%24rootWeb)%0A%20%20%20%20%20%20%20%20%24ctx.Load(%24childWebs)%0A%20%20%20%20%20%20%20%20%24ctx.ExecuteQuery()%0A%0A%20%20%20%20%20%20%20%20%23%20perform%20update%0A%20%20%20%20%20%20%20%20if(%24rootWeb.WebTemplate%20-ne%20%22APP%22)%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%24rootWeb.Url%20%22is%20being%20updated%20to%20exclude%20from%20offline%20clients%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%24rootWeb.ExcludeFromOfflineClient%3D%24true%0A%20%20%20%20%20%20%20%20%20%20%20%20%24rootWeb.Update()%0A%20%20%20%20%20%20%20%20%20%20%20%20%24ctx.Load(%24rootWeb)%0A%20%20%20%20%20%20%20%20%20%20%20%20%24ctx.ExecuteQuery()%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22ExcludeFromOfflineClient%20is%20now%22%20%24rootWeb.ExcludeFromOfflineClient%20%22for%20the%20site%3A%22%20%24rootWeb.Url%20-ForegroundColor%20Green%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%23%20loop%20subsites%20of%20subsites%0A%20%20%20%20%20%20%20%20foreach%20(%24childWeb%20in%20%24childWebs)%0A%20%20%20%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20processsubsites%20%24childWeb.url%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%0A%0A%7D%3C%2FPRE%3E%3CP%3ETo%20note%2C%20%3CSPAN%3ESetting%20this%20property%20to%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22input%22%3Etrue%3C%2FSPAN%3E%3CSPAN%3E%20does%20not%20disable%20synchronization.%20Instead%2C%20it%20represents%20a%20recommendation%20to%20the%20client%20not%20to%20attempt%20synchronization.%20This%20info%20is%20pulled%20from%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fmicrosoft.sharepoint.spweb.excludefromofflineclient.aspx%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44072%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44072%22%20slang%3D%22en-US%22%3EThe%20scripts%20discussed%20here%20are%20for%20document%20libraries.%20For%20the%20setting%20you%20want%20to%20disable%20(basically%20you%20want%20to%20mark%20a%20site%20as%20not%20searchable)%20you%20need%20a%20script%20(I%20don't%20recall%20If%20I%20have%20one%20for%20this%20scenario%20that%20uses%20CSOM)%20that%20does%20this%20at%20the%20site%20level%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44065%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44065%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Juan%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20read%20the%20posts%20here%20a%20few%20times%2C%20but%20are%20still%20not%20sure%20that%20this%20will%20solve%20what%20i%20am%20trying%20to%20do.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20basicly%20looking%20for%20a%20scriptet%20solution%20that%20does%20the%20same%20as%20opening%20site%20settings%20for%20a%20single%20SPO%20site%20or%20O365%20group%2C%20going%20into%20%22Search%20and%20offline%20availability%22%20and%20select%20no%20to%20%22Specify%20whether%20this%20site%20should%20be%20available%20for%20offline%20clients%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20i%20use%20your%20Csom%20script%20for%20this%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42382%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42382%22%20slang%3D%22en-US%22%3E%3CP%3EShould%20that%20comment%20be%20%22users%20sometimes%20do%20silly%20things%22%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENever%20mind...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42379%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42379%22%20slang%3D%22en-US%22%3E%3A)%3C%2Fimg%3E%20Users%20some%20times%20want%20to%20do%20unexpected%20things...%40Salvatore%20if%20the%20template%20ID%20approach%20does%20not%20work%20for%20you%2C%20use%20the%20document%20library%20name%20instead%20and%20read%20the%20document%20libraries%20names%20for%20every%20group%20form%20a%20CSV%20you%20have%20created%20beforehand%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42375%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42375%22%20slang%3D%22en-US%22%3E%3CP%3EI%20can't%20think%20of%20why%20a%20user%20would%20want%20or%20attempt%20to%20synchronize%20these%20libraries...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42372%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42372%22%20slang%3D%22en-US%22%3E%3CP%3EMy%20feeling%20is%20that%20it%20is%20not%20important%20if%20synchronization%20is%20disabled%20for%20these%20%22system%22%20libraries%26nbsp%3B(and%20anyway%20users%20never%20synchronize%20them%2C%20I%20think)%2C%20but%20I%20would%20like%20to%20have%20an%20%22authoritative%22%20answer...%20%3Cimg%20id%3D%22smileyvery-happy%22%20class%3D%22emoticon%20emoticon-smileyvery-happy%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Fi%2Fsmilies%2F16x16_smiley-very-happy.png%22%20alt%3D%22Smiley%20Very%20Happy%22%20title%3D%22Smiley%20Very%20Happy%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42369%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42369%22%20slang%3D%22en-US%22%3E%3CP%3EI%20guess%20I%20need%20more%20context.%20I%20do%20not%20think%20that%20the%20%22system%22%20document%20libraries%20are%20used%20by%20Office%20365%20Groups%20-%20unless%20someone%20can%20shed%20more%20light%20on%20this%20topic.%20If%20that%20is%20the%20case%2C%20then%20it%20might%20not%20be%20important%20if%20synchronization%20was%20disabled%20for%20these%20libraries.%20Do%20users%20ever%20synchronize%20them%20anyway%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42366%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42366%22%20slang%3D%22en-US%22%3E%3CP%3ENevertheless%2C%20my%20question%20still%20remains%20unanswered...%3C%2FP%3E%3CP%3EI%20will%20try%20to%20be%20more%20clear.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20know%20the%20following%20facts%3A%3C%2FP%3E%3COL%3E%3CLI%3EIn%20every%20Group%20we%20have%20a%20main%20%22user%22%20document%20library%20(with%20template%20ID%20101).%20In%20Italian%20it%20is%20called%3A%20%3CEM%3EDocumenti%3C%2FEM%3E.%3C%2FLI%3E%3CLI%3EIn%20every%20Group%20we%20also%20have%20what%20I%20would%20call%20%22system%22%20document%20libraries%20(with%20template%20ID%20101).%26nbsp%3BIn%20Italian%26nbsp%3Bthey%20are%20called%3A%20%3CEM%3EModelli%20di%20modulo%2C%20Raccolta%20stili%2C%20Risorse%20del%20sito%3C%2FEM%3E.%3C%2FLI%3E%3CLI%3EIn%20every%20Group%20we%20can%20create%20other%20%22user%22%20document%20libraries%20(with%20template%20ID%20101).%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAll%20this%20said%2C%20if%20we%20want%20to%20hide%20the%20sync%20button%20in%20all%20%22user%22%20libraries%20by%20means%20of%20a%20script%2C%20and%20we%20select%20the%20libraries%20on%20the%20basis%20of%20template%20ID%20101%2C%20we%20will%20(try%20to)%20hide%20the%20sync%20button%20also%20in%20the%20%22system%22%20document%20libraries%20(point%202)%20and%20not%20only%20in%20the%20%22user%22%20document%20libraries%20(point%201%20and%20point%203).%3C%2FP%3E%3CP%3EMy%20question%20is%3A%20is%20this%20safe%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(Of%20course%20in%20the%20script%20I%20can%20select%20the%20%22user%22%20document%20libraries%20%22by%20name%22%2C%20but%20while%20this%20is%20easily%20feasible%20for%20the%20%22main%22%20one%20(point%201%20above)%2C%20it%20is%20instead%20difficult%20for%20the%20others%20(point%203%20above))...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42359%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42359%22%20slang%3D%22en-US%22%3E%3CP%3ETa.%20Like%20everywhere%20in%20Office%20365%2C%20if%20you%20take%20your%20eyes%20off%20the%20ball%20for%20a%20few%20minutes%2C%20things%20might%20change...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGood%20to%20know%20about%20the%20identifiers%20for%20document%20libraries.%20I%20like%20factoids%20like%20that!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42351%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42351%22%20slang%3D%22en-US%22%3ESorry%20guys%20for%20not%20joining%20on%20time%20to%20the%20party%20%3A-)...here%20my%20comments%3A%3CBR%20%2F%3E-%20101%20is%20the%20template%20ID%20for%20any%20document%20librarie%20in%20SharePoint%20(no%20matter%20if%20we%20talk%20about%20SharePoint%20OnPremises%20or%20Online%2C%20Modern%20Team%20Sites%20or%20Classic%20ones%2C%20or%20Groups%20sites)%3CBR%20%2F%3E%3CBR%20%2F%3E-%20GROUPS%230%20identifies%20the%20site%20template%20used%20for%20a%20Group%20site...but%20in%20a%20site%20you%20can%20create%20Document%20Libraries%20and%20lists%20and%20for%20them%20you%20have%20a%20template%20ID%3A%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fmicrosoft.sharepoint.splisttemplatetype.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fmicrosoft.sharepoint.splisttemplatetype.aspx%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIn%20regards%20of%20Tony's%20questions%3A%3CBR%20%2F%3E1.%20Correct%3CBR%20%2F%3E2.%20Correct%20(hiding%20the%20Sync%20option%20is%20just%20a%20cosmetic%20customization)%3CBR%20%2F%3E3.%20Correct%3CBR%20%2F%3E4.%20Correct%3CBR%20%2F%3E5.%20Of%20course%20%3A)%3C%2Fimg%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42348%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42348%22%20slang%3D%22en-US%22%3E%3CP%3ELibrary.BaseTemplate%20%3D%20101%20specifies%20document%20libraries%20belonging%20to%20Office%20365%20Groups...%20Or%20all%20modern%20sites%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20past%2C%20Groups%20used%20a%20special%20Group%230%20template%20for%20its%20sites.%20Is%20that%20the%20same%20now%20(in%20an%20airplane%20with%20limited%20wi-fi%20so%20don't%20want%20to%20go%20through%20the%20slowwwwwww%20network%20check...)%20Maybe%20someone%20knows%20offhand.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42337%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42337%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%3C%2FP%3E%3CP%3EMy%20two%20cents%3A%3C%2FP%3E%3COL%3E%3CLI%3ECorrect.%20You%20can%20do%20it%20manually%20in%20the%20UI%2C%26nbsp%3Blibrary%26nbsp%3Bby%20library.%20Or%20by%20a%20script.%3C%2FLI%3E%3CLI%3EIMHO%20correct.%3C%2FLI%3E%3CLI%3EIMHO%20correct.%3C%2FLI%3E%3CLI%3ECorrect.%20My%20concern%20is%20that%20the%20condition%20%3CI%3E%24Library.BaseTemplate%20-eq%20%22101%22%3C%2FI%3E%20in%20Brent's%20script%20captures%20(hence%20setting%20%3CEM%3EExcludeFromOfflineClient%3D%24true)%3C%2FEM%3E%26nbsp%3Balso%20other%20%22system%22%20libraries%20and%20not%20only%20the%20(possibly%20multiple)%20%22user%22%20document%20libraries%20in%20each%20Group.%20Is%20it%20safe%20doing%20so%3F%3C%2FLI%3E%3CLI%3EIMHO%20correct.%20(e.g.%20point%204%26nbsp%3Bshould%20be%20evaluated%20carefully).%3C%2FLI%3E%3C%2FOL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42327%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42327%22%20slang%3D%22en-US%22%3E%3CP%3EForgive%20this%20non-SPO%20person%20asking%20a%20question%2C%20but%20I%20would%20like%20to%20summarize%20what%20has%20been%20discussed%20here.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3EYou%20can%20disable%20the%20Sync%20option%20that%20appears%20in%20the%20commands%20available%20within%20a%20document%20library.%3C%2FLI%3E%3CLI%3EDisabling%20the%20Sync%20option%20does%20not%20stop%20the%20OneDrive%20client%20synchronizing%20data%20if%20the%20synchronization%20was%20already%20set%20up%20and%20active.%3C%2FLI%3E%3CLI%3EThe%20scripts%20to%20do%20the%20work%20depend%20on%20the%20SharePoint%20CSOM%20(i.e.%20you%20can't%20just%20run%20Set-SPOSite%20or%20Set-UnifiedGroup%20to%20set%20a%20property%20-%20which%20would%20be%20nice).%3C%2FLI%3E%3CLI%3ECare%20needs%20to%20be%20taken%20to%20ensure%20that%20only%20the%20desired%20document%20libraries%20(those%20associated%20with%20Groups)%20are%20affected.%3C%2FLI%3E%3CLI%3ETwo%20example%20scripts%20are%20available%20-%20one%20from%20Juan%20Carlos%20and%20the%20other%20from%20Brent.%20Normal%20health%20practices%20to%20be%20observed%20(always%20test%20and%20never%20run%20in%20production%20until%20you%20are%20100%25%20happy%20that%20code%20downloaded%20from%20the%20internet%20is%20secure%20and%20does%20what%20you%20expect).%26nbsp%3B%3C%2FLI%3E%3C%2FOL%3E%3CP%3EDid%20I%20get%20that%20right%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42254%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42254%22%20slang%3D%22en-US%22%3EYes...this%20setting%20purely%20hide%20the%20sync%20button%20in%20the%20Web%20UI%20and%20does%20not%20have%20any%20influence%20on%20the%20OneDrive%20clients...so%20if%20users%20have%20already%20synchronized%20the%20Groups%20libraries%2C%20you%20will%20have%20to%20look%20for%20a%20way%20to%20disabling%20this%20synchronization%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42252%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42252%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Juan!%3C%2FP%3E%3CP%3EAnd%2C%20after%20disabling%2C%20what%20happens%20to%20the%20local%20syncs%20already%20configured%20in%20the%20various%20machines%3F%3C%2FP%3E%3CP%3EWill%20they%20be%20automagically%20disabled%20(and%20in%20this%20case%20what%20will%20happen%20to%20the%20local%20file%20copies%3F)%20or%20will%20they%20continue%20to%20work%3F%3C%2FP%3E%3CP%3EIn%20other%20words%2C%20does%20the%20setting%20purely%20hide%26nbsp%3Bthe%20sync%20button%20in%20the%20web%20UI%2C%20or%20does%20it%20influence%20the%20behaviour%20of%20the%20OneDrive%20clients%20on%20the%20various%20machines%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42249%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42249%22%20slang%3D%22en-US%22%3EWhat%20you%20could%20do%20is%20read%20the%20name%20of%20the%20document%20libraries%20you%20want%20to%20configure%20from%20a%20CSV%20file...and%20yes%2C%20I%20meant%20that%20a%20Group%20owner%20can%20configure%20the%20setting%20on%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42243%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42243%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Brent.%3C%2FP%3E%3CP%3EThe%20best%20would%20be%20to%20disable%20sync%20for%20all%20actual%20doclibs%20(i.e.%20the%20main%20one%20and%20any%20other%20doclibs%20created%20by%20the%20users)%20but%20not%20for%20other%20%22system%22%20libraries.%3C%2FP%3E%3CP%3EUnfortunately%20it%20looks%20like%20the%20condition%20%3CEM%3E%24Library.BaseTemplate%20-eq%20%22101%22%3C%2FEM%3E%20captures%20other%20%22system%22%20libraries%20as%20well%20(precisely%2C%20in%20Italian%3A%20%3CEM%3EModelli%20di%20modulo%2C%20Raccolta%20stili%2C%20Risorse%20del%20sito%3C%2FEM%3E).%3C%2FP%3E%3CP%3EI%20wonder%20if%20flipping%20%3CEM%3EExcludeFromOfflineClient%3C%2FEM%3E%20also%20for%20such%20%22system%22%20libraries%20(which%20appear%20to%20have%20%3CI%3E%24Library.BaseTemplate%20-eq%20%22101%22%3C%2FI%3E)%20could%20have%20adverse%20side%20effects%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42242%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42242%22%20slang%3D%22en-US%22%3EI%20just%20assumed%20you%20wanted%20sync%20disabled%20across%20the%20board.%20The%20script%20gets%20any%20predefined%20doc%20libs%2C%20but%20also%20any%20other%20extra%20libraries%20that%20are%20created%20in%20the%20Group%20SharePoint%20site.%20You%20can%20add%20an%20extra%20%22if%22%20statement%20to%20limit%20it%20to%20a%20specific%20Library%3CBR%20%2F%3E%3CBR%20%2F%3Eif(%24Library.BaseTemplate%20-eq%20%22101%22%20-and%20%24Library.Title%20-eq%20%22Documents%22)%7B%3CBR%20%2F%3E%3CBR%20%2F%3ESubstitute%20%22Documents%22%20for%20whatever%20language%20phrase%20the%20main%20document%20library%20is.%20Not%20sure%20if%20it%20can%20be%20renamed%20in%20the%20group%2C%20so%20worse%20case%20might%20have%20to%20check%20the%20Library%20URL%20to%20make%20sure%20it%20is%20Shared%2520Documents.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42241%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42241%22%20slang%3D%22en-US%22%3E%3CP%3ETesting%20the%20script%2C%20I%20noticed%20that%20it%20sets%20%22ExcludeFromOfflineClient%3D%24true%22%20not%20only%20on%20the%20main%20doclib%20of%20the%20Group%2C%20but%20also%20on%20other%20libraries%20(in%20Italian%2C%20the%20typical%26nbsp%3Blibraries%20affected%20are%3A%20Documenti%2C%20Modelli%20di%20modulo%2C%20Raccolta%20stili%2C%20Risorse%20del%20sito).%3C%2FP%3E%3CP%3EDoes%20this%20have%20adverse%20consequences%3F%3C%2FP%3E%3CP%3EHow%20to%20restrict%20the%20script%20only%20to%20actual%20doclibs%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42235%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42235%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20very%20much%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F60%22%20target%3D%22_blank%22%3E%40Juan%20Carlos%20Gonz%C3%A1lez%20Mart%C3%ADn%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F637%22%20target%3D%22_blank%22%3E%40Brent%20Ellis%3C%2FA%3E%26nbsp%3B!!!%3C%2FP%3E%3CP%3EI%20have%20a%20couple%20of%20questions%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F60%22%20target%3D%22_blank%22%3E%40Juan%20Carlos%20Gonz%C3%A1lez%20Mart%C3%ADn%3C%2FA%3E%3A%26nbsp%3Bwhy%20do%20you%20say%20%22temporarily%22%3F%20Do%20you%20mean%20that%20the%20setting%20can%20in%20any%20moment%20be%20changed%20by%20a%20Group%20owner%3F%3C%2FLI%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F637%22%20target%3D%22_blank%22%3E%40Brent%20Ellis%3C%2FA%3E%3A%20the%20script%20disables%20sync%20for%20all%20the%20doclibs%20in%20a%20Group%2C%20not%20only%20the%20main%20one%2C%26nbsp%3Bcorrect%3F%3C%2FLI%3E%3CLI%3EWhat%20happens%20to%20the%20syncs%20already%20running%3F%20Will%20they%20be%20disabled%20or%20will%20they%20continue%20to%20run%3F%3C%2FLI%3E%3C%2FUL%3E%3CP%3ETIA%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42225%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42225%22%20slang%3D%22en-US%22%3E%3CP%3ELooks%20like%20it%20was%20still%20reading%20from%20my%20older%20version%20of%20CSOM%2C%20but%20got%20it%20working%20quick%20and%20dirty%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EAdd-Type%20-Path%20%22C%3A%5CSP%5CMicrosoft.SharePointOnline.CSOM.16.1.6112.1200%5Clib%5Cnet45%5CMicrosoft.SharePoint.Client.dll%22%0AAdd-Type%20-Path%20%22C%3A%5CSP%5CMicrosoft.SharePointOnline.CSOM.16.1.6112.1200%5Clib%5Cnet45%5CMicrosoft.SharePoint.Client.runtime.dll%22%0A%0A%23%20SharePoint%20Authentication%0A%24username%20%3D%20%22%26lt%3Busername%20here%26gt%3B%22%0A%24password%20%3D%20'%26lt%3Bpassword%20here%26gt%3B'%0A%24securePassword%20%3D%20ConvertTo-SecureString%20%24Password%20-AsPlainText%20-Force%20%0A%24credentials%20%3D%20New-Object%20Microsoft.SharePoint.Client.SharePointOnlineCredentials(%24username%2C%20%24securePassword)%20%0A%0AWrite-Host%20%22Fetching%20O365%20Groups%22%20-ForegroundColor%20Yellow%0A%24o365Groups%20%3D%20get-unifiedgroup%0A%24count%20%3D%200%0A%0Aforeach(%24group%20in%20%24o365Groups)%7B%0A%20%20%20%20%24count%2B%2B%0A%20%20%20%20Write-Host%20%22%22%0A%20%20%20%20Write-Host%20%24count%20%24group.DisplayName%20%24group.primarysmtpaddress%20-ForegroundColor%20Cyan%0A%0A%20%20%20%20%24clientContext%20%3D%20New-Object%20Microsoft.SharePoint.Client.ClientContext(%24group.SharePointSiteUrl)%20%0A%20%20%20%20%24clientContext.Credentials%20%3D%20%24credentials%20%0A%0A%20%20%20%20if%20(%24clientContext.ServerObjectIsNull.Value)%20%7B%20%0A%20%20%20%20%20%20%20%20Write-Host%20%22Unable%20to%20connect%20to%3A%20'%24url'%22%20-ForegroundColor%20Red%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20Write-Host%20%22Connected%20to%3A%20'%24(%24group.SharePointSiteUrl)'%22%20-ForegroundColor%20Green%20%0A%0A%20%20%20%20%20%20%20%20%24Libraries%20%3D%20%24clientContext.Web.Lists%0A%20%20%20%20%20%20%20%20%24clientContext.Load(%24Libraries)%0A%20%20%20%20%20%20%20%20%24clientContext.ExecuteQuery()%0A%0A%20%20%20%20%20%20%20%20foreach(%24Library%20in%20%24Libraries)%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20if(%24Library.BaseTemplate%20-eq%20%22101%22)%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%24Library.Title%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24Library.ExcludeFromOfflineClient%3D%24true%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24Library.Update()%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%7D%0A%0A%7D%0A%0A%0A%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42221%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42221%22%20slang%3D%22en-US%22%3EBrent%2C%20check%20my%20script...It%20works%20and%20I%20used%20December%20edition%20of%20the%20CSOM%20(%3CA%20href%3D%22https%3A%2F%2Fjcgonzalezmartin.wordpress.com%2F2017%2F01%2F19%2Foffice-365-how-to-disable-files-synchronization-in-spo-doc-libraries-ii%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fjcgonzalezmartin.wordpress.com%2F2017%2F01%2F19%2Foffice-365-how-to-disable-files-synchronization-in-spo-doc-libraries-ii%2F%3C%2FA%3E)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42220%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42220%22%20slang%3D%22en-US%22%3ESmall%20update%20from%20my%20side...Groups%20Sites%20and%20Office%20365%20Channel%20Sites%20are%20not%20hidden%20anymore%20when%20using%20Get-SPOSite%2C%20so%20you%20can%20choose%20to%20use%20Get-SPOSite%20or%20Groups%20cmdlets%20(probably%20better%20to%20use%20these%20ones)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42219%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42219%22%20slang%3D%22en-US%22%3EI've%20got%20something%20similar%20to%20this%20running%20(iterating%20content%20in%20Groups)%3CBR%20%2F%3E%3CBR%20%2F%3EI've%20also%20upgrade%20to%20the%20latest%20CSOM%20assemblies%2C%20but%20I%20don't%20see%20the%20parameter%20exposed%20in%20the%20Group%20sites%2Flibraries%20(i%20think%20it%20is%20ExcludeFromOfflineClient).%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42214%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42214%22%20slang%3D%22en-US%22%3EYou%20should%20be%20able%20to%20%22temporary%22%20hide%20the%20%22sync%22%20action%20in%20the%20Groups%20Library%20using%20CSOM%20(Client%20Side%20Object%20Model)%20in%20a%20PowerShell%20script...and%20I%20say%20%22should%22%20because%20in%20the%20past%20I%20have%20found%20some%20weird%20problems%20when%20using%20CSOM%20with%20Groups%20sites...but%20this%20should%20not%20be%20the%20case%20anymore%20since%20a%20Group%20site%20is%20a%20modern%20site.%20By%20the%20way%2C%20I%20have%20a%20script%20that%20hides%20the%20sync%20action%20for%20a%20document%20library%20in%20SPO%20using%20CSOM%3A%20%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2FHow-to-enabledisable-sync-8ad53996%3Fredir%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgallery.technet.microsoft.com%2FHow-to-enabledisable-sync-8ad53996%3Fredir%3D0%3C%2FA%3E%20(Bear%20in%20mind%20you%20will%20need%20to%20use%20at%20least%20August%202016%20version%20of%20CSOM...I%20recommend%20you%20to%20use%20the%20once%20released%20by%20Microsoft%20yesterday%20(%3CA%20href%3D%22https%3A%2F%2Fjcgonzalezmartin.wordpress.com%2F2017%2F01%2F28%2Foffice-365-january-version-of-spo-csom-just-released%2F)....and%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fjcgonzalezmartin.wordpress.com%2F2017%2F01%2F28%2Foffice-365-january-version-of-spo-csom-just-released%2F)....and%3C%2FA%3E%20to%20get%20the%20CSOM%20assemblies%20via%20NuGet%20using%20PowerShell%20just%20follow%20this%20post%3A%20%3CA%20href%3D%22https%3A%2F%2Fjcgonzalezmartin.wordpress.com%2F2017%2F01%2F09%2Ftips-tricks-how-to-install-a-nuget-package-without-visual-studio-installed%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fjcgonzalezmartin.wordpress.com%2F2017%2F01%2F09%2Ftips-tricks-how-to-install-a-nuget-package-without-visual-studio-installed%2F%3C%2FA%3E%3CBR%20%2F%3EFinally%2C%20you%20will%20need%20to%20buy%20the%20code%20to%20get%20the%20all%20the%20Groups%20sites%20in%20the%20tenant.%20You%20can%20use%20this%20post%20as%20a%20starting%20point%20%EF%81%8A%3A%20%3CA%20href%3D%22http%3A%2F%2Fwww.andrewjbillings.com%2Fenumerating-sharepoint-sites-for-office-365-groups-with-powershell%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fwww.andrewjbillings.com%2Fenumerating-sharepoint-sites-for-office-365-groups-with-powershell%2F%3C%2FA%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42213%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42213%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%2C%20Tony.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42212%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20mass%20disable%20sync%20for%20Office%20365%20Groups%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42212%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20sorry%2C%20but%20I%20do%20not%20know%20of%20any%20way%20to%20disable%20the%20ability%20for%20users%20to%20synchronize%20a%20document%20library%20via%20PowerShell...%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Trusted Contributor

A customer of mine wants to disable sync for all Groups doclibs.

AFAIK there is not a global setting for this.

I know that it is possible to do it manually for every single doclib in the advanced library settings, but such approach is impractical for hundreds of Groups.

Can someone point me to an existing script for doing it for all Groups in a tenant?

TIA.

cc @Juan Carlos González Martín @Santhosh Balakrishnan @Tony Redmond

30 Replies
Highlighted

I am sorry, but I do not know of any way to disable the ability for users to synchronize a document library via PowerShell...

Highlighted

Thank you, Tony.

Highlighted
You should be able to "temporary" hide the "sync" action in the Groups Library using CSOM (Client Side Object Model) in a PowerShell script...and I say "should" because in the past I have found some weird problems when using CSOM with Groups sites...but this should not be the case anymore since a Group site is a modern site. By the way, I have a script that hides the sync action for a document library in SPO using CSOM: https://gallery.technet.microsoft.com/How-to-enabledisable-sync-8ad53996?redir=0 (Bear in mind you will need to use at least August 2016 version of CSOM...I recommend you to use the once released by Microsoft yesterday (https://jcgonzalezmartin.wordpress.com/2017/01/28/office-365-january-version-of-spo-csom-just-releas... to get the CSOM assemblies via NuGet using PowerShell just follow this post: https://jcgonzalezmartin.wordpress.com/2017/01/09/tips-tricks-how-to-install-a-nuget-package-without...
Finally, you will need to buy the code to get the all the Groups sites in the tenant. You can use this post as a starting point : http://www.andrewjbillings.com/enumerating-sharepoint-sites-for-office-365-groups-with-powershell/
Highlighted
I've got something similar to this running (iterating content in Groups)

I've also upgrade to the latest CSOM assemblies, but I don't see the parameter exposed in the Group sites/libraries (i think it is ExcludeFromOfflineClient).
Highlighted
Small update from my side...Groups Sites and Office 365 Channel Sites are not hidden anymore when using Get-SPOSite, so you can choose to use Get-SPOSite or Groups cmdlets (probably better to use these ones)
Highlighted
Highlighted

Looks like it was still reading from my older version of CSOM, but got it working quick and dirty:

 

Add-Type -Path "C:\SP\Microsoft.SharePointOnline.CSOM.16.1.6112.1200\lib\net45\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\SP\Microsoft.SharePointOnline.CSOM.16.1.6112.1200\lib\net45\Microsoft.SharePoint.Client.runtime.dll"

# SharePoint Authentication
$username = "<username here>"
$password = '<password here>'
$securePassword = ConvertTo-SecureString $Password -AsPlainText -Force 
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword) 

Write-Host "Fetching O365 Groups" -ForegroundColor Yellow
$o365Groups = get-unifiedgroup
$count = 0

foreach($group in $o365Groups){
    $count++
    Write-Host ""
    Write-Host $count $group.DisplayName $group.primarysmtpaddress -ForegroundColor Cyan

    $clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($group.SharePointSiteUrl) 
    $clientContext.Credentials = $credentials 

    if ($clientContext.ServerObjectIsNull.Value) { 
        Write-Host "Unable to connect to: '$url'" -ForegroundColor Red
    } else {
        Write-Host "Connected to: '$($group.SharePointSiteUrl)'" -ForegroundColor Green 

        $Libraries = $clientContext.Web.Lists
        $clientContext.Load($Libraries)
        $clientContext.ExecuteQuery()

        foreach($Library in $Libraries){
            if($Library.BaseTemplate -eq "101"){
                Write-Host $Library.Title
                $Library.ExcludeFromOfflineClient=$true
                $Library.Update()
            }
        }

    }

}


Highlighted

Thank you very much @Juan Carlos González Martín @Brent Ellis !!!

I have a couple of questions:

  • @Juan Carlos González Martín: why do you say "temporarily"? Do you mean that the setting can in any moment be changed by a Group owner?
  • @Brent Ellis: the script disables sync for all the doclibs in a Group, not only the main one, correct?
  • What happens to the syncs already running? Will they be disabled or will they continue to run?

TIA

Highlighted

Testing the script, I noticed that it sets "ExcludeFromOfflineClient=$true" not only on the main doclib of the Group, but also on other libraries (in Italian, the typical libraries affected are: Documenti, Modelli di modulo, Raccolta stili, Risorse del sito).

Does this have adverse consequences?

How to restrict the script only to actual doclibs?

 

Highlighted
I just assumed you wanted sync disabled across the board. The script gets any predefined doc libs, but also any other extra libraries that are created in the Group SharePoint site. You can add an extra "if" statement to limit it to a specific Library

if($Library.BaseTemplate -eq "101" -and $Library.Title -eq "Documents"){

Substitute "Documents" for whatever language phrase the main document library is. Not sure if it can be renamed in the group, so worse case might have to check the Library URL to make sure it is Shared%20Documents.
Highlighted

Thanks Brent.

The best would be to disable sync for all actual doclibs (i.e. the main one and any other doclibs created by the users) but not for other "system" libraries.

Unfortunately it looks like the condition $Library.BaseTemplate -eq "101" captures other "system" libraries as well (precisely, in Italian: Modelli di modulo, Raccolta stili, Risorse del sito).

I wonder if flipping ExcludeFromOfflineClient also for such "system" libraries (which appear to have $Library.BaseTemplate -eq "101") could have adverse side effects ?

Highlighted
What you could do is read the name of the document libraries you want to configure from a CSV file...and yes, I meant that a Group owner can configure the setting on
Highlighted

Thanks Juan!

And, after disabling, what happens to the local syncs already configured in the various machines?

Will they be automagically disabled (and in this case what will happen to the local file copies?) or will they continue to work?

In other words, does the setting purely hide the sync button in the web UI, or does it influence the behaviour of the OneDrive clients on the various machines?

Highlighted
Yes...this setting purely hide the sync button in the Web UI and does not have any influence on the OneDrive clients...so if users have already synchronized the Groups libraries, you will have to look for a way to disabling this synchronization
Highlighted

Forgive this non-SPO person asking a question, but I would like to summarize what has been discussed here.

 

  1. You can disable the Sync option that appears in the commands available within a document library.
  2. Disabling the Sync option does not stop the OneDrive client synchronizing data if the synchronization was already set up and active.
  3. The scripts to do the work depend on the SharePoint CSOM (i.e. you can't just run Set-SPOSite or Set-UnifiedGroup to set a property - which would be nice).
  4. Care needs to be taken to ensure that only the desired document libraries (those associated with Groups) are affected.
  5. Two example scripts are available - one from Juan Carlos and the other from Brent. Normal health practices to be observed (always test and never run in production until you are 100% happy that code downloaded from the internet is secure and does what you expect). 

Did I get that right?

Highlighted

@Tony Redmond

My two cents:

  1. Correct. You can do it manually in the UI, library by library. Or by a script.
  2. IMHO correct.
  3. IMHO correct.
  4. Correct. My concern is that the condition $Library.BaseTemplate -eq "101" in Brent's script captures (hence setting ExcludeFromOfflineClient=$true) also other "system" libraries and not only the (possibly multiple) "user" document libraries in each Group. Is it safe doing so?
  5. IMHO correct. (e.g. point 4 should be evaluated carefully).
Highlighted

Library.BaseTemplate = 101 specifies document libraries belonging to Office 365 Groups... Or all modern sites?

 

In the past, Groups used a special Group#0 template for its sites. Is that the same now (in an airplane with limited wi-fi so don't want to go through the slowwwwwww network check...) Maybe someone knows offhand.

Highlighted
Sorry guys for not joining on time to the party :-)...here my comments:
- 101 is the template ID for any document librarie in SharePoint (no matter if we talk about SharePoint OnPremises or Online, Modern Team Sites or Classic ones, or Groups sites)

- GROUPS#0 identifies the site template used for a Group site...but in a site you can create Document Libraries and lists and for them you have a template ID: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splisttemplatetype.aspx

In regards of Tony's questions:
1. Correct
2. Correct (hiding the Sync option is just a cosmetic customization)
3. Correct
4. Correct
5. Of course :)
Highlighted

Ta. Like everywhere in Office 365, if you take your eyes off the ball for a few minutes, things might change...

 

Good to know about the identifiers for document libraries. I like factoids like that!