Can we import SharePoint Online PnP powershell module in PowerShell Core 6.0 and use the cmdlets? I tried Connect-PnPOnline and I get the below error:

The type initializer for 'Microsoft.SharePoint.Client.ClientContextExtensions' threw an exception.


Unfortunately, the answer is no at the moment.

PowerShell Core 6.0 is built on top of .NET Core 2.0 runtime. But the thing is, PnP PowerShell depends on PnP CSOM Core components which are dependent on SharePoint CSOM libraries. Now, SharePoint CSOM libraries are dependent internally on some "other" libraries which are, as yet, not compatible with .NET Core.

Once, the CSOM libraries are ported or made compatible with .NET Core, we will be able to use it in PowerShell Core 6.0 and above.

Uservoice - Support .NET core with CSOM

There is this uservoice link where Microsoft has mentioned that they are looking into this thibg but has no ETA mentioned.

Also, I am assuming that you need to "do something cross-platform" , on a non-windows machine, if so, I would suggest that you take a look at Office365-cli using which you manage any Office 365 tenant from any platform. Currently, the commands available are limited compared to PnP PowerShell but its growing quite fast. Office 365 cli internally calls the RESTful API endpoints which are platform agnostic.

References - Office365-cli

Managing Office 365 on any platform

Office 365 comparison with SPO and PnP PowerShell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.