Forum Discussion

Anonymous's avatar
Anonymous
Dec 04, 2016

Error when using PnP powershell and CSOM

Hi,

 

I am trying out the "O365 Intranet starter" from PnP.

Almost everything is working just fine, but i have some issues.

 

This function expects a Web object (Get-PnPWeb is the same as the "old" Get-SPOWeb):

function Enable-CustomItemScheduling {
[CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true)]
        [Microsoft.SharePoint.Client.Web]$Web,
        [Parameter(Mandatory=$true)]
        [String]$PagesLibraryName
    ) 

And it's being called like this:

Enable-CustomItemScheduling -Web (Get-PnPWeb) -PagesLibraryName "Pages"

It might be a .dll issue(?), but I don't know how to tell, but this is the error I get:

"Cannot convert the "Microsoft.SharePoint.Client.Web" value of type "Microsoft.SharePoint.Client.Web" to type "Microsoft.SharePoint.Client.Web"

I've tried playing around with the cmdlet and passing as a Microsoft.SharePoint.Client.Web, but the same error exists.

 

I have installed:

  • SharePoint online sdk
  • SharePoint Online Management Shell
  • Have rebuilt the "custom" .dll that is utilized in the deployment with the newest SharePoint Online Nuget
  • Downloaded the latest PnP Powershell and installed

 

If anyone knows where I should start looking, it would be most helpful

 

/Simon

 

8 Replies

    • Initially this feels like a conflict between the various versions of the CSOM sdk. The PnP Cmdlets come with the CSOM SDK included, so you don't have to install that SDK. The downloadable SDK is most likely also older than the one that comes with the PnP Cmdlets (the PnP cmdlets are always using the latest SDK, usually before the downloadable package is updated by MS). My initial try would be to uninstall the SDK (which installs the SDK into the GAC, which is generally a 'bad' thing).

Resources