pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
415 stars 642 forks source link

Provisioning files from remote machine to on-prem causes Method not found: 'System.String Microsoft.SharePoint.Client.WebParts.WebPartDefinition.get_ZoneId()' #2306

Open spexmario opened 5 years ago

spexmario commented 5 years ago

Category

[X] Bug [ ] Enhancement

Environment

[ ] Office 365 / SharePoint Online [X] SharePoint 2016 [ ] SharePoint 2013

CU version: January 2019

Expected or Desired Behavior

<pnp:Templates ID="MainSiteCollectionTemplate">
    <pnp:ProvisioningTemplate ID="Homepage" Version="1.0" Scope="RootSite" BaseSiteTemplate="STS#0" TemplateCultureInfo="1033">
        <pnp:Files>
        <pnp:File Src="logo.jpg" Folder="SiteAssets" Overwrite="true" TargetFileName="logo.jpg" />
    </pnp:Files>
    </pnp:ProvisioningTemplate>
</pnp:Templates>

Apply the template above and see the file logo.jpg uploaded to the SiteAssets library.

Observed Behavior

When applying the template from a remote machine, it throws the exception:

Apply-PnPProvisioningTemplate : Method not found: 'System.String Microsoft.SharePoint.Client.WebParts.WebPartDefinition.get_ZoneId()'.
At C:\Users\almema\Documents\Apply-PnPTemplate.ps1:144 char:5
+     Apply-PnPProvisioningTemplate -Web $web -Path $templatePath
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Apply-PnPProvisioningTemplate], MissingMethodException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate

When applying the template locally, in the SharePoint server, the file is uploaded correctly.

Steps to Reproduce

ghost commented 5 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

pkbullock commented 5 years ago

ZoneId was added to CSOM earlier this year and has a dependency on server patch level, is your farm patched beyond May 2018? See reference: https://developer.microsoft.com/en-us/sharepoint/blogs/updated-versions-of-the-sharepoint-on-premises-csom-nuget-packages/