Forum Discussion

Kiril Iliev's avatar
Kiril Iliev
Brass Contributor
Apr 26, 2017

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

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.

    • Kiril Iliev's avatar
      Kiril Iliev
      Brass Contributor

      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

      • VesaJuvonen's avatar
        VesaJuvonen
        Icon for Microsoft rankMicrosoft

        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" 

         

Resources