Skip to main content

Import-Module: Method not found

Fix the MissingMethodException that occurs when running Import-Module ShareGate with Microsoft Graph SDK 2.36 or later installed system-wide.

Note: PowerShell integration requires a ShareGate Migrate Pro or Enterprise subscription. It is not available on the Essentials plan.

Symptoms

When you run Import-Module ShareGate in PowerShell, you get the following error:

Import-Module: Method not found: 'System.Collections.Generic.IList`1<System.Net.Http.DelegatingHandler> Microsoft.Graph.GraphClientFactory.CreateDefaultHandlers(Microsoft.Graph.GraphClientOptions)'

Error code

Not applicable.

Details

This error occurs when the Microsoft Graph SDK version 2.36.0 or later is installed at the system level on your machine.

ShareGate Migrate includes its own bundled version of the Microsoft Graph DLLs.

When a newer version of the Microsoft Graph SDK is installed system-wide, PowerShell loads it instead of ShareGate Migrate's bundled version.

Version 2.36.0 removed a method that ShareGate Migrate relies on, causing the module to fail during import.

Solution

You can try to downgrade the Microsoft Graph SDK to a compatible version:

  1. Open PowerShell as administrator.

  2. Run the following command to remove all installed versions of the Microsoft Graph SDK:

    Uninstall-Module Microsoft.Graph -AllVersions -Force
  3. Run the following command to install a compatible version:

    Install-Module Microsoft.Graph -RequiredVersion 2.28.0 -Force
  4. Restart PowerShell and run Import-Module ShareGate again.

Caution: Downgrading the Graph SDK could affect other applications on your system. You make these changes at your own risk.

If you still get the error

Contact our support team with the following:

  • The full error message

  • The Microsoft Graph SDK version currently installed on your machine (run Get-InstalledModule Microsoft.Graph to check)

  • What you've already tried

Did this answer your question?