Error enabling Office 365 CDN - Method "GetTenantCdnAllowedFileTypes" does not exist

%3CLINGO-SUB%20id%3D%22lingo-sub-65022%22%20slang%3D%22en-US%22%3EError%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-65022%22%20slang%3D%22en-US%22%3E%3CP%3EI%20was%20trying%20to%20enable%20the%20private%20and%20public%20CDNs%20for%20our%20tenant%20but%20I%20was%20getting%20error%20with%20the%26nbsp%3BSet-SPOTenantCdnEnabled%20PowerShell%20command%20-%20regardless%20of%20the%20CdnType%20switch%20-%20public%20or%20private.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20running%20the%26nbsp%3Blatest%20SharePoint%20Online%20Management%20Shell%26nbsp%3Band%20I%20am%20a%20tenant%20admin.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-65022%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-163268%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-163268%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Vesa.%3C%2FP%3E%0A%3CP%3EThis%20one%20seems%20a%20correct%20one%2C%20but%20I%20got%20error%22%20The%20specified%20account%20already%20exists%22%20during%20the%20installation.%20I%20have%20to%20go%20to%20the%20system%20registry%20(regedit)%20to%20search%20string%20%22SharePoint%20Online%20Management%20Shell%22%20and%20delete%20all%20related%20entries.%3C%2FP%3E%0A%3CP%3EFinally%20it%26nbsp%3Bworked.%3C%2FP%3E%0A%3CP%3EHope%20others%20can%20find%20this%20place%20to%20make%20it%20work.%3C%2FP%3E%0A%3CP%3EGeorge%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-163238%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-163238%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EI'm%20not%20sure%20what%20packages%20we%20are%20talking%20in%20here%20exactly%2C%20but%20it's%20true%20that%20the%20PowerShell%20msi%20for%20SharePoint%20Management%20Shell%20would%20need%20to%20be%20always%20uninstalled%20and%20then%20installed.%20Not%20really%20a%20massive%20job%20to%20do.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20install%20SPO%20Management%20Shell%20from%20the%20following%20location%2C%20you%20should%20not%20have%20any%20issues%20with%26nbsp%3Bany%20dll's%20or%20packages.%20If%20you%20do%20have%20issue%2C%20would%20like%20to%20have%20more%20details%20to%20understand%20what%20is%20exactly%20wrong%20and%20what%20exactly%20do%20you%20mean%20with%26nbsp%3B%22%3CSPAN%3Edll%20hell%22%20or%20%22package%20hell%22%20in%20this%20context%2C%20so%20that%20we%20can%20fix%20it.%26nbsp%3BUnfortunately%2C%20that%20term%20as%20such%20does%20not%20provide%20sufficient%20amount%20of%20details%20to%20fix%20this%20for%20the%20future.%20Also%20unclear%20on%20what%20exactly%20you%20are%20referring%20to%26nbsp%3Ba%20term%20%22tool%22.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EDownload%20SPO%20management%20Shell%20from%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D35588%26nbsp%3B%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D35588%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThis%20is%20evolving%20with%20new%20versions%20as%20we%20add%20new%20capabilities%20to%20SharePoint%20Online.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20post%20is%20quite%20old%20so%20assumption%20with%20the%20latest%20documentation%20and%20guidance%20has%20been%20that%20it's%20suitable%20for%20reuse%20since%20we%20have%20NOT%20received%20this%20kind%20of%20input%20recently.%26nbsp%3BThanks%20for%20the%20additional%20details%20advance.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-163227%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-163227%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20point%20is%20that%20this%20is%20not%20a%20working%20document!%3C%2FP%3E%0A%3CP%3EThe%20document%20link%20that%20you%20send%20doesn't%20work.%20That%20is%20why%20people%20has%20the%20forum%20to%20discuss%20how%20to%20working%20around!%3C%2FP%3E%0A%3CP%3EThe%20Microsoft%20needs%20to%20have%20a%20clear%20document%20mention%20all%20the%20dependency%20of%20the%20Dlls%2C%20versions.%3C%2FP%3E%0A%3CP%3ECurrently%2C%20developers%20are%20facing%20Microsoft%20%22dll%20hell%22%20or%20%22package%20hell%22.%20The%20latest%20package%20doesn't%20even%20remove%20the%20old%20package.%20The%20different%20packages%20over%20write%20the%20assemble%20each%20other.%3C%2FP%3E%0A%3CP%3ESo%3A%20In%20able%20to%20run%20this%20piece%20of%20code%20what%20really%20needs%20in%20terms%20of%20Dlls%2Fpackages%2FCSOM%20to%20get%20ride%20of%20this%20annoyed%20error%20%22%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23ff0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EGet-SPOTenantCdnEnabled%20%3A%20The%20term%20'Get-SPOTenantCdnEnabled'%20is%20not%20recognized%20as%20the%20name%20of%20a%20cmdlet%2C%20function%2C%20%3C%2FFONT%3E%22%3C%2FP%3E%0A%3CP%3E%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20tool%20suppose%20to%20help%20the%20developers%20to%20make%20the%20life%20easy.%20Now%20we%20have%20to%20figure%20out%20which%20version%20will%20work%20and%20how%20to%20make%20the%20tool%20works!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-163219%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-163219%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20George%2C%3C%2FP%3E%0A%3CP%3Edidn't%20quite%20get%20the%20message%20completely%2C%20but%20if%20you%20are%20looking%20for%20documentation%2C%20here's%20the%20official%20documentation%20in%20the%20docs.microsoft.com.%20Feel%20free%20to%20start%20up%20a%20new%20discussion%20in%20MS%20Tech%20Community%20and%26nbsp%3Bcc%20me%20in%20the%20discussion%20if%20you%20still%20have%20other%20questions%20or%20challenges.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fgeneral-development%2Foffice-365-cdn%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fgeneral-development%2Foffice-365-cdn%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAll%20feedback%20on%20the%20documentation%20and%20guidance%20is%20more%20than%20welcome.%20Thanks%20for%20your%20input%20advance.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-163213%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-163213%22%20slang%3D%22en-US%22%3E%3CP%3EMicrosoft%20just%20get%20the%20situation%20worse%20!%3C%2FP%3E%0A%3CP%3ECan't%20find%20a%20definitely%20working%20instruction!%3C%2FP%3E%0A%3CP%3EThe%20law%20needs%20to%20split%20the%20Microsoft%20in%20two!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-65719%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-65719%22%20slang%3D%22en-US%22%3E%3CP%3EI%20took%20another%20approach%20and%20something%20wierd%20happened%26nbsp%3B-%20a%20console%20application%20with%20the%20latest%20PnP%20Core%20component%20NuGet%20package.%20Here%20is%20a%20sample%20code%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%20Tenant%20tenant%20%3D%20new%20Tenant(adminCtx)%3B%0A%20tenant.SetTenantCdnEnabled(SPOTenantCdnType.Public%2C%20true)%3B%0A%20adminCtx.ExecuteQueryRetry()%3B%0A%20var%20isEnabled%20%3D%20tenant.GetTenantCdnEnabled(SPOTenantCdnType.Public)%3B%3CBR%20%2F%3E%20adminCtx.ExecuteQueryRetry()%3B%3CBR%20%2F%3E%2F%2F%20debug%20mode%20-%26gt%3B%20check%20isEnabled.Value%20property%3C%2FPRE%3E%3CP%3EAt%20first%2C%20it%20has%20enabled%20the%20public%26nbsp%3BCdn%2C%20but%20later%20when%20I%20tried%20to%20add%20a%20public%20CDN%20origin%20to%20one%20of%20my%20libraries%20(with%20the%20AddPublicCdnOrigin)%2C%20it%20threw%20an%20exception%20that%20the%20Public%20CDN%20was%20disabled.%20Running%20the%20above%20code%2C%20gave%20me%20that%20the%20CDN's%20value%26nbsp%3Bwas%20set%20to%20false%20for%20some%20reason%2C%20regardless%20if%20I%20set%20it%20again%20through%20the%20C%23%20code%20to%20true.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-65469%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-65469%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20don't%20need%20to%20reference%20any%20DLLs%20when%20you%20are%20using%20SPO%20Management%20Shell%20cmdlets%2C%20so%20that%20part%20is%20definitely%20not%20needed%2C%20but%20it%20does%20not%20explain%20the%20exception%20what%20you%20are%20seeing%2C%20since%20that%20would%20still%20indicate%20that%20a%20wrong%20CSOM%20assembly%20is%20loaded%20from%20GAC%20to%20the%20execution.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFollowing%20part%20is%20not%20needed%2C%20since%20SPO%20cmdlet's%20do%20load%20the%20CSOM%20assemblies%20automatically.%20That%20would%20be%20only%20needed%20if%20you%20would%20use%20native%20CSOM%20in%20your%20scripts.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EAdd-Type%20-Path%20%22PathToDlls%5CMicrosoft.SharePoint.Client.dll%22%20%0AAdd-Type%20-Path%20%22PathToDlls%5CMicrosoft.SharePoint.Client.Runtime.dl%3CWBR%20%2F%3El%22%20%0AAdd-Type%20-Path%20%22PathToDlls%5CMicrosoft.Online.SharePoint.Client.Ten%3CWBR%20%2F%3Eant.dll%22%20%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-65464%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-65464%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20done%20the%20following%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-%26nbsp%3Buninstalled%20the%20SDK%3C%2FP%3E%3CP%3E-%20restarted%20the%20SharePoint%20Online%20Management%20Shell%3C%2FP%3E%3CP%3E-%20Added%20reference%20to%20the%20DLLs%20with%20version%2016.1.6323.1200%20(latest%20as%20of%20now)%20via%20Add-Type%20-Path%20%22PathToDll%22%26nbsp%3Bfor%20Microsoft.SharePoint.Client.dll%2C%20Microsoft.SharePoint.Client.Runtime.dll%20and%20Microsoft.Online.SharePoint.Client.Tenant.dll%20(I%20believe%20that%20the%20needed%20methods%20would%20be%20all%20in%20the%20last%20assembly%2C%20but%20added%20the%20rest%20of%20the%20CSOM%20assemblies%20just%20to%20be%20sure)%3C%2FP%3E%3CP%3E-%20Tried%20to%20run%20the%20script%20entirely%20in%20the%20Windows%20PowerShell%20ISE%20as%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%24securePassword%20%3D%20ConvertTo-SecureString%20%24Password%20-AsPlainText%20-Force%20%0A%24cred%20%3D%20New-Object%20System.Management.Automation.PSCredential%20-ArgumentList%20%24username%2C%20%24securePassword%0A%0AConnect-SPOService%20-Credential%20%24cred%20-Url%20%24tenantAdminUrl%0A%0AAdd-Type%20-Path%20%22PathToDlls%5CMicrosoft.SharePoint.Client.dll%22%20%0AAdd-Type%20-Path%20%22PathToDlls%5CMicrosoft.SharePoint.Client.Runtime.dll%22%20%0AAdd-Type%20-Path%20%22PathToDlls%5CMicrosoft.Online.SharePoint.Client.Tenant.dll%22%20%0A%0ASet-SPOTenantCdnEnabled%20-CdnType%20Public%20-Enable%20%24true%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EStill%20getting%20Set-SPOTenantCdnEnabled%20%3A%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EKiril%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-65452%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20enabling%20Office%20365%20CDN%20-%20Method%20%22GetTenantCdnAllowedFileTypes%22%20does%20not%20exist%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-65452%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F5489%22%20target%3D%22_blank%22%3E%40Kiril%20Iliev%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EOnly%20logical%20reason%20for%20this%20would%20be%20that%20you%20have%20SharePoint%20Online%20Clinet%20Components%20SDK%20(%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D42038%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D42038%3C%2FA%3E)%20installed%20on%20your%20machine%20where%20you%20are%20using%20these%20PowerShell%20cmdlets.%20This%20error%20is%20then%20actually%20raised%20by%20the%20assembly%20conflict%20in%20your%20local%20machine%20and%20it's%20not%20coming%20from%20SharePoint%20Online.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EChallenge%20with%20the%20SDK%20is%20that%20it%20installs%20CSOM%20assemblies%20to%20GAC%2C%20which%20then%20overrides%20them%20to%20be%20used%20by%20the%20PowerShell%20cmdlets%20when%20they%20are%20used%20in%20PowerShell%20session.%20In%20general%20we%20do%20NOT%20recommend%20using%20this%20SDK%2C%20rather%20reference%20the%20needed%20assemblies%20as%20a%20NuGet%20package%20(%3CA%20href%3D%22https%3A%2F%2Fwww.nuget.org%2Fpackages%2FMicrosoft.SharePointOnline.CSOM%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nuget.org%2Fpackages%2FMicrosoft.SharePointOnline.CSOM%3C%2FA%3E)%2C%20so%20that%20you'll%20get%20the%20latest%20and%20greatest%20APIs%20for%20your%20solutions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20uninstall%20the%20SDK%20from%20your%20machine%2C%20PowerShell%20cmdlets%20will%20use%20locally%20deployed%20assemblies%2C%20whcih%20should%20resolve%20your%20issue.%20If%20this%20is%20not%20the%20scenario%20or%20you'll%20still%20have%20the%20issue%20regardless%20of%20uninstalling%20this%20SDK%2C%20there's%20something%20else%20wrong.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHopefully%20that%20solves%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

I was trying to enable the private and public CDNs for our tenant but I was getting error with the Set-SPOTenantCdnEnabled PowerShell command - regardless of the CdnType switch - public or private.

 

I am running the latest SharePoint Online Management Shell and I am a tenant admin.

9 Replies

Hi @Kiril Iliev,

Only logical reason for this would be that you have SharePoint Online Clinet Components SDK (https://www.microsoft.com/en-us/download/details.aspx?id=42038) installed on your machine where you are using these PowerShell cmdlets. This error is then actually raised by the assembly conflict in your local machine and it's not coming from SharePoint Online. 

 

Challenge with the SDK is that it installs CSOM assemblies to GAC, which then overrides them to be used by the PowerShell cmdlets when they are used in PowerShell session. In general we do NOT recommend using this SDK, rather reference the needed assemblies as a NuGet package (https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM), so that you'll get the latest and greatest APIs for your solutions.

 

If you uninstall the SDK from your machine, PowerShell cmdlets will use locally deployed assemblies, whcih should resolve your issue. If this is not the scenario or you'll still have the issue regardless of uninstalling this SDK, there's something else wrong. 

 

Hopefully that solves it.

I have done the following:

 

- uninstalled the SDK

- restarted the SharePoint Online Management Shell

- Added reference to the DLLs with version 16.1.6323.1200 (latest as of now) via Add-Type -Path "PathToDll" for Microsoft.SharePoint.Client.dll, Microsoft.SharePoint.Client.Runtime.dll and Microsoft.Online.SharePoint.Client.Tenant.dll (I believe that the needed methods would be all in the last assembly, but added the rest of the CSOM assemblies just to be sure)

- Tried to run the script entirely in the Windows PowerShell ISE as"

 

$securePassword = ConvertTo-SecureString $Password -AsPlainText -Force 
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $securePassword

Connect-SPOService -Credential $cred -Url $tenantAdminUrl

Add-Type -Path "PathToDlls\Microsoft.SharePoint.Client.dll" 
Add-Type -Path "PathToDlls\Microsoft.SharePoint.Client.Runtime.dll" 
Add-Type -Path "PathToDlls\Microsoft.Online.SharePoint.Client.Tenant.dll" 

Set-SPOTenantCdnEnabled -CdnType Public -Enable $true

 

Still getting Set-SPOTenantCdnEnabled : Method "GetTenantCdnAllowedFileTypes" does not exist.

 

Thanks,

Kiril

You don't need to reference any DLLs when you are using SPO Management Shell cmdlets, so that part is definitely not needed, but it does not explain the exception what you are seeing, since that would still indicate that a wrong CSOM assembly is loaded from GAC to the execution.

 

Following part is not needed, since SPO cmdlet's do load the CSOM assemblies automatically. That would be only needed if you would use native CSOM in your scripts.

 

Add-Type -Path "PathToDlls\Microsoft.SharePoint.Client.dll" 
Add-Type -Path "PathToDlls\Microsoft.SharePoint.Client.Runtime.dll" 
Add-Type -Path "PathToDlls\Microsoft.Online.SharePoint.Client.Tenant.dll" 

 

I took another approach and something wierd happened - a console application with the latest PnP Core component NuGet package. Here is a sample code:

 

 Tenant tenant = new Tenant(adminCtx);
 tenant.SetTenantCdnEnabled(SPOTenantCdnType.Public, true);
 adminCtx.ExecuteQueryRetry();
 var isEnabled = tenant.GetTenantCdnEnabled(SPOTenantCdnType.Public);
adminCtx.ExecuteQueryRetry();
// debug mode -> check isEnabled.Value property

At first, it has enabled the public Cdn, but later when I tried to add a public CDN origin to one of my libraries (with the AddPublicCdnOrigin), it threw an exception that the Public CDN was disabled. Running the above code, gave me that the CDN's value was set to false for some reason, regardless if I set it again through the C# code to true.

Microsoft just get the situation worse !

Can't find a definitely working instruction!

The law needs to split the Microsoft in two!

Hi George,

didn't quite get the message completely, but if you are looking for documentation, here's the official documentation in the docs.microsoft.com. Feel free to start up a new discussion in MS Tech Community and cc me in the discussion if you still have other questions or challenges.

 

All feedback on the documentation and guidance is more than welcome. Thanks for your input advance. 

 

 

The point is that this is not a working document!

The document link that you send doesn't work. That is why people has the forum to discuss how to working around!

The Microsoft needs to have a clear document mention all the dependency of the Dlls, versions.

Currently, developers are facing Microsoft "dll hell" or "package hell". The latest package doesn't even remove the old package. The different packages over write the assemble each other.

So: In able to run this piece of code what really needs in terms of Dlls/packages/CSOM to get ride of this annoyed error "

Get-SPOTenantCdnEnabled : The term 'Get-SPOTenantCdnEnabled' is not recognized as the name of a cmdlet, function, "

?

 

The tool suppose to help the developers to make the life easy. Now we have to figure out which version will work and how to make the tool works!

 

 

Hi,

I'm not sure what packages we are talking in here exactly, but it's true that the PowerShell msi for SharePoint Management Shell would need to be always uninstalled and then installed. Not really a massive job to do. 

 

If you install SPO Management Shell from the following location, you should not have any issues with any dll's or packages. If you do have issue, would like to have more details to understand what is exactly wrong and what exactly do you mean with "dll hell" or "package hell" in this context, so that we can fix it. Unfortunately, that term as such does not provide sufficient amount of details to fix this for the future. Also unclear on what exactly you are referring to a term "tool".

 

This is evolving with new versions as we add new capabilities to SharePoint Online. 

 

This post is quite old so assumption with the latest documentation and guidance has been that it's suitable for reuse since we have NOT received this kind of input recently. Thanks for the additional details advance. 

Thanks Vesa.

This one seems a correct one, but I got error" The specified account already exists" during the installation. I have to go to the system registry (regedit) to search string "SharePoint Online Management Shell" and delete all related entries.

Finally it worked.

Hope others can find this place to make it work.

George