Monday 17 April 2023

SharePoint Online Management Shell V16.0 assembly error fix

Issue:

I recently required to use SharePoint Management shell to run some O365 PowerShell commands. But as soon as I run the SharePoint Management shell in administrative mode, I received below error:

Could not load type 'Microsoft.SharePoint.Client.Publishing.PortalLaunch.PortalLaunchRedirectionType' from assembly 'Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.



I have gone through many links that tells to uninstall the assembly and reinstall, but I didn’t find the exact step by step guide. So, I am writing this blog to provide step by step guide in case someone else might face such issue.

Resolution:

The reason of this error is conflicts between different versions of Sharepoint Online SDKs (SharePoint Client Components, SharePoint Online Management Shell). So correct way to solve this problem is the following:
  • Go to Control Panel > Programs and features and uninstall all instances of SharePoint Online Management Shell and SharePoint Client Components.

  • Open PowerShell console and uninstall existing versions of Microsoft.Online.SharePoint.PowerShell module:
 Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -AllVersions  
  • After that close PowerShell, open new session and install latest version of Microsoft.Online.SharePoint.PowerShell module:
 Import-Module -Name Microsoft.Online.SharePoint.PowerShell -Force   


Now when you start the SharePoint Online Management Shell as administrator, you will not face the error.



Reference:

  • http://sadomovalex.blogspot.com/2020/09/how-to-fix-error-could-not-load-type.html

No comments:

Post a Comment