-1

I am trying out Franck Cornu's O365StarterIntranet, from Patterns and Practices (PnP).

I have updated to the latest PnP powershell Online, the latest SharePoint Online SDK.

Most of the things work fine, but this is the error I get. When calling "Enable-CustomItemScheduling"

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

It seems that the web object gotten from "Get-SPOWeb" or "Get-PnPWeb" (tried both) cannot convert to Microsoft.SharePoint.Client.Web.

As you can se below, the function expects a "Microsoft.SharePoint.Client.Web".

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

The function is called like this, where Get-PnPWeb is the same as Get-SPOWeb in former PnP powershell releases:

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

Have you any idea on how I can fix this and where to look?

0

Try using

function Enable-CustomItemScheduling {
[CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true)]
        [OfficeDevPnP.Core.PnPClientContext]$CurrentContext,
        [Parameter(Mandatory=$true)]
        [String]$PagesLibraryName
    )

and then use the context to get the web

Enable-CustomItemScheduling --Web $CurrentContext.Web -PagesLibraryName "Pages"

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.