pnp / PnP-Sites-Core

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

Apply-PnPProvisioningTemplate error for list instance creation: "Unable to find an SPForm matching URL" #2528

Open RogerZhang-CatapultSystems opened 4 years ago

RogerZhang-CatapultSystems commented 4 years ago

Category

[ ] Bug

Environment

[ ] Office 365 / SharePoint Online

Expected or Desired Behavior

The template for creating list should be successfully applied to target site, even there have list templates created in list template gallery.

Observed Behavior

When target site have list template created, after calling cmdlet Apply-PnPProvisioningTemplate, there will have error throw Unable to find an SPForm matching URL , such as /sites/RogerZhangCommunicationShowCaseSite01/Lists/catdsgspscoop/DispForm.aspx

Apply-PnPProvisioningTemplate : Unable to find an SPForm matching URL /sites/RogerZhangShowCaseProvisioningWithListTemplate/Lists/catdsgspscoop/DispForm.aspx. Parameter name: path At line:1 char:1

  • Apply-PnPProvisioningTemplate -Path D:\Catapult\Source\Cat_DSG_SP_Val ...
  • CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException
  • FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate

and when you go to the target site's site content, you may see the list named as {ListUri} or {List Title} such as catdsgspscoop or 'Catapult System Scoop' . But when you open the list, you will see the created list default view columns are not from the provisioning template and actually it may be created by list template since it will match one of your site list template.

Steps to Reproduce

  1. Create a new communication show case site in your tenant.
  2. Using SharePoint Online management Shell cmdlet to set DenyAddAndCustomizePages as false to enable the list template feature.
    • Connect-SPOService -url $tenantAdminUrl -Credential $credentials
    • Set-SPOsite $siteCollectionUrl -DenyAddAndCustomizePages 0
  3. Manually create new list and add more columns for the list either create new content type for list or just add column directly.
  4. Go to the newly created list settings page and click save list as template link, then fill in required template properties and save the template.
  5. Using latest PnP cmdlets(current version is 3.16.1912.0) to do list provisioning.
    • Using Connect-PnPOnline to connected to step 1 created site
    • Using Apply-PnPProvisioningTemplate to do provisioning to step 1 created site. The provisioning template as below
      <?xml version="1.0"?>
      <pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2019/09/ProvisioningSchema">
      <pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.16.1912.0, Culture=neutral, PublicKeyToken=5e633289e95c321a" />
      <pnp:Templates ID="CONTAINER-TEMPLATE-CatDsgSpTheScoop">
      <pnp:ProvisioningTemplate ID="TEMPLATE-CatDsgSpTheScoop" Version="1" BaseSiteTemplate="SITEPAGEPUBLISHING#0" Scope="RootSite">
      <pnp:SiteFields>
      <Field Type="URL" DisplayName="Scoop Image" Required="TRUE" EnforceUniqueValues="FALSE" Indexed="FALSE" Format="Image" Group="Catapult Systems Columns" ID="{ca086075-bc5b-4fa5-80b4-b83cea595bf8}" SourceID="{3b48873d-a92e-4ee4-9491-0458d303fcd5}" StaticName="catdsgscoopImage" Name="catdsgscoopImage" AllowDeletion="TRUE">
      </Field>
      <Field Type="Choice" DisplayName="Scoop Active" Required="TRUE" EnforceUniqueValues="FALSE" Indexed="FALSE" Format="Dropdown" FillInChoice="FALSE" Group="Catapult Systems Columns" ID="{ccab7a76-6615-4a0c-856e-661a4a2710b0}" SourceID="{3b48873d-a92e-4ee4-9491-0458d303fcd5}" StaticName="catdsgscoopActive" Name="catdsgscoopActive" AllowDeletion="TRUE">
        <Default>Yes</Default>
        <CHOICES>
          <CHOICE>Yes</CHOICE>
          <CHOICE>No</CHOICE>
        </CHOICES>
      </Field>
      <Field Type="Note" DisplayName="Scoop Description" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" NumLines="6" RichText="FALSE" Sortable="FALSE" Group="Catapult Systems Columns" ID="{cb57d3cc-01d7-42a9-9b0a-2fb89c1f97b9}" SourceID="{3b48873d-a92e-4ee4-9491-0458d303fcd5}" StaticName="catdsgscoopDescription" Name="catdsgscoopDescription" AllowDeletion="TRUE">
      </Field>
      <Field Type="URL" DisplayName="Scoop Link Url" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" Format="Hyperlink" Group="Catapult Systems Columns" ID="{488b80cd-cc20-44ec-940d-7f26231ba82a}" SourceID="{3b48873d-a92e-4ee4-9491-0458d303fcd5}" StaticName="catdsgscoopLinkURL" Name="catdsgscoopLinkURL" AllowDeletion="TRUE">
      </Field>
      </pnp:SiteFields>
      <pnp:ContentTypes>
      <pnp:ContentType ID="0x0100874B33E3060139408243B098E5F480B8" Name="Scoop" Description="" Group="Catapult Systems Content Types" NewFormUrl="" EditFormUrl="" DisplayFormUrl="">
        <pnp:FieldRefs>
          <pnp:FieldRef ID="c042a256-787d-4a6f-8a8a-cf6ab767f12d" Name="ContentType" />
          <pnp:FieldRef ID="fa564e0f-0c70-4ab9-b863-0177e6ddd247" Name="Title" Required="true" />
          <pnp:FieldRef ID="cb57d3cc-01d7-42a9-9b0a-2fb89c1f97b9" Name="catdsgscoopDescription" />
          <pnp:FieldRef ID="ca086075-bc5b-4fa5-80b4-b83cea595bf8" Name="catdsgscoopImage" Required="true" />
          <pnp:FieldRef ID="488b80cd-cc20-44ec-940d-7f26231ba82a" Name="catdsgscoopLinkURL" />
          <pnp:FieldRef ID="ccab7a76-6615-4a0c-856e-661a4a2710b0" Name="catdsgscoopActive" Required="true" />
        </pnp:FieldRefs>
      </pnp:ContentType>
      </pnp:ContentTypes>
      <pnp:Lists>
      <pnp:ListInstance Title="Catapult Systems Scoop" Description="" DocumentTemplate="" TemplateType="100" Url="Lists/catdsgspscoop" MinorVersionLimit="0" MaxVersionLimit="0" DraftVersionVisibility="0" TemplateFeatureID="00bfea71-de22-43b2-a848-c05709900100" ContentTypesEnabled="true" EnableFolderCreation="false" DefaultDisplayFormUrl="{site}/Lists/catdsgspscoop/DispForm.aspx" DefaultEditFormUrl="{site}/Lists/catdsgspscoop/EditForm.aspx" DefaultNewFormUrl="{site}/Lists/catdsgspscoop/NewForm.aspx" ImageUrl="{site}/_layouts/15/images/itgen.png?rev=47" IrmExpire="false" IrmReject="false" IsApplicationList="false" ValidationFormula="" ValidationMessage="">
        <pnp:ContentTypeBindings>
          <pnp:ContentTypeBinding ContentTypeID="0x0100874B33E3060139408243B098E5F480B8" Default="true" />
          <pnp:ContentTypeBinding ContentTypeID="0x01" />
          <pnp:ContentTypeBinding ContentTypeID="0x0120" />
        </pnp:ContentTypeBindings>
        <pnp:Views>
          <View Name="{287B7E66-9CEC-41AC-AD7C-B81B12D93998}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="All Items" Url="{site}/Lists/catdsgspscoop/AllItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="{site}/_layouts/15/images/generic.png?rev=47">
            <Query>
              <OrderBy>
                <FieldRef Name="ID" />
              </OrderBy>
            </Query>
            <ViewFields>
              <FieldRef Name="LinkTitle" />
              <FieldRef Name="catdsgscoopDescription" />
              <FieldRef Name="catdsgscoopImage" />
              <FieldRef Name="catdsgscoopLinkURL" />
              <FieldRef Name="catdsgscoopActive" />
            </ViewFields>
            <RowLimit Paged="TRUE">30</RowLimit>
            <Aggregations Value="Off" />
            <JSLink>clienttemplates.js</JSLink>
          </View>
        </pnp:Views>
        <pnp:FieldRefs>
          <pnp:FieldRef ID="cb57d3cc-01d7-42a9-9b0a-2fb89c1f97b9" Name="catdsgscoopDescription" DisplayName="Scoop Description" />
          <pnp:FieldRef ID="ca086075-bc5b-4fa5-80b4-b83cea595bf8" Name="catdsgscoopImage" DisplayName="Scoop Image" />
          <pnp:FieldRef ID="488b80cd-cc20-44ec-940d-7f26231ba82a" Name="catdsgscoopLinkURL" DisplayName="Scoop Link Url" />
          <pnp:FieldRef ID="ccab7a76-6615-4a0c-856e-661a4a2710b0" Name="catdsgscoopActive" DisplayName="Scoop Active" />
        </pnp:FieldRefs>
      </pnp:ListInstance>
      </pnp:Lists>
      </pnp:ProvisioningTemplate>
      </pnp:Templates>
      </pnp:Provisioning>
  6. You will see the error "Unable to find an SPForm matching URL"
  7. Navigate to the site content and you will see the provisioning list was created, but the list columns are not from the provisioning template and actually it may be created by list template(we created in step 4 ), since the columns totally match.

**FYI:

ghost commented 4 years ago

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