pnp/PnP

Starter Intranet: Apply-PnPProvisioningTemplate Invalid Field

jbarrar opened this issue · 10 comments

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you. If you have a actual question, we would ask you to use SharePoint Developer Group at Microsoft Tech Community. Thanks!

####Which PnP repository should you use to report the issue?####
Please navigate to the appropriate repository by clicking on the link below and create your issue there. You can delete this section after you have navigated to the correct repository.

Category

[ X ] Bug
[ ] Enhancement

Environment

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

If SharePoint on-premises, what's exact CU version:

Expected or Desired Behavior

In multiple Office 365 tenants, both the unaltered github code and code that worked two months ago fail to complete initial deployment to SharePoint Online Publishing Sites.

Observed Behavior

Invalid field name errors. First encountered on seoBrowserTitle. After removing that from RootSiteTemplate.xml, errors were reported for RobotsNoIndex. Because this happens in more than one SharePoint tenant, I'm wondering if fields were deprecated in the recent changes within SharePoint Online in reference to the Classic Experience that this solution seems to depend upon.

Installation started on 04/25/2019 01:14:27

Target site: 'https://sycom365beta.sharepoint.com/sites/rigdemo'

Bundling the application (development mode)...		Done!
Uploading all files in the style library...		Done!

powershell : Apply-PnPProvisioningTemplate : Invalid field name. {325c00dd-fd91-468b-81cf-5bb9951abba1}
At line:1 char:1

  • powershell -executionPolicy bypass -file ".\Deploy-Intranet.ps1"
  •   + CategoryInfo          : NotSpecified: (Apply-PnPProvis...-5bb9951abba1} :String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    

https://sycom365beta.sharepoint.com/sites/rigdemo
At C:\projects\Business.StarterIntranet\Deploy-Solution.ps1:170 char:2

  • Apply-PnPProvisioningTemplate -Path $ProvisioningRootSiteTemplate ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException
    • FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate

    Configuring the root site...

Hi @jbarrar Try to downgrade your PnP PowerShell cmdlets version instead using the latest. Use December 2017 version as a starting point.

For context, I was able to create a site in January with the December 2018 cmdlets with no errors. Running node 8.9.4, same as before.

I first downgraded from the latest to December 2018 cmdlets (I didn't read carefully) and received the same error. I then downgraded to December 2017 and received a different error. This current error is from a fresh download of the PNP github, no edits. Just an "npm i" to install packages and execution of the Deploy script. Also loading to a freshly created Sharepoint Online Publishing Portal site.


Installation started on 04/26/2019 14:16:52

Target site: 'https://sycom365beta.sharepoint.com/sites/rigdemov2'

Bundling the application (development mode)...		Done!
Uploading all files in the style library...		Done!

powershell : Apply-PnPProvisioningTemplate : Could not load file or assembly 'System.IdentityModel.Tokens.Jwt, Version=5.1.5.0,
At line:1 char:1

  • powershell -executionPolicy bypass -file ".\Deploy-Intranet.ps1"
  •   + CategoryInfo          : NotSpecified: (Apply-PnPProvis...rsion=5.1.5.0, :String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    

Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file
specified.
At C:\projects\Business.StarterIntranet\Deploy-Solution.ps1:170 char:2

  • Apply-PnPProvisioningTemplate -Path $ProvisioningRootSiteTemplate ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], FileNotFoundException
    • FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate

    Configuring the root site...

@jbarrar it seems to be an environment issue. Did you install the .Net framework on your machine?

@FranckyC I'm running 4.7.2. One thing that has changed since the last time I successfully deployed an Intranet site is I installed Visual Studio Community 2019 for another project. Was just using VSCode on this machine before. The other person seeing the same errors also has Visual Studio installed. I moved up to the April 2018 PnP cmdlets from December 2017 and it's back to:
powershell : Apply-PnPProvisioningTemplate : Invalid field name. {ff92f929-d18b-46d4-9879-521378c689ef}

Installation was successful in January 2019 with newer cmdlets. I'm going to try building a site with a "clean" PC on a fresh OS install next week.

@FranckyC A clean laptop runs into the same two issues. Either I get the "Could not load file or assembly System.IdentityModel.Tokens.Jwt, Version=5.1.5.0" error with the December 2017 cmdlets or I get the "Invalid field name" error with the January 2018 cmdlets. Are we sure something wasn't deprecated within SharePointOnline in the last 60 days? The same versions/settings that worked in January are now failing. I can't find any documentation on the changes MS may have made that I've seen in the SPO environment recently.

Hi @jbarrar . It is quite strange. Did you try without the 'SeoBrowserTitle' and 'RobotsNoIndex' field references in the provisioning template? These fields are not really relevant for the solution so you should be fine. It seems something has changed in the SPO back end.

Brilliant, @FranckyC. Yesterday, I removed the guid references to SeoBrowserTitle, RobotsNoIndex, SeoMetaDescription and SeoKeywords from the provisioning xml files (RootSite and SubSite). I got an error that the fields were missing. Today, I realized that I had missed the lines that set RobotsNoIndex to "False" in the xml files. I removed those and the site deployed successfully. I will document exactly what I changed and get it submitted to you. Thank you so much for helping me through this.

Hi @jbarrar, glad it works! So you end up by using the December 2017 cmdlets? I will updated these files. Thank you!