Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect-SPOService error:Could not load type 'Microsoft.SharePoint.Client.SharePointOnlineCredentials

I am trying to connect to SharePoint with Powershell Connect-SPOService But I get the error:

| Could not load type 'Microsoft.SharePoint.Client.SharePointOnlineCredentials' from assembly
     | 'Microsoft.SharePoint.Client.Runtime, Version=16.1.0.0, Culture=neutral,
     | PublicKeyToken=71e9bce111e9429c'.

I reinstalled Microsoft.Online.SharePoint.PowerShell and import it. But still. I also have PnP.PowerShell installed. can that be the issue?

like image 788
Ofer Gal Avatar asked Oct 18 '25 18:10

Ofer Gal


1 Answers

This is due to DLL Version mismatch. To resolve the issue, follow these steps:

  1. Uninstall SharePoint Online Management Shell and SharePoint Online Client SDK if installed.
  2. Delete SharePoint Online Client Assemblies from: C:\Windows\Microsoft.NET\assembly\GAC_MSIL, Remove all Folders starting with name: Microsoft.SharePoint*
  3. Uninstall the module with Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell and reinstall the module Install-Module -Name Microsoft.Online.SharePoint.PowerShell
like image 76
danijeljw-RPC Avatar answered Oct 21 '25 10:10

danijeljw-RPC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!