pnp / pnp/pnpframework

[BUG] Add-PnPListFoldersToSiteTemplate: [...] invalid child element 'Preferences' [...]

Open
#450 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
259
Forks
161
Avg merge
10h 33m
Merged PRs (30d)
1

Description

Background

I'd like to add folders to a (simple) site provisioning template.

Expected behavior

I expect this code to work, to get the Documents list and to add the folders to the list:

Get-PnPSiteTemplate -Handlers ContentTypes,Lists -Out template.xml -ListsToExtract "Documents"
Add-PnPListFoldersToSiteTemplate -List "Documents" -Path template.xml

Actual behavior

I get this error:

Add-PnPListFoldersToSiteTemplate: The element 'Provisioning' in namespace 'http://schemas.dev.office.com/PnP/2021/03/ProvisioningSchema' has invalid child element 'Preferences' in namespace 'http://schemas.dev.office.com/PnP/2021/03/ProvisioningSchema'. List of possible elements expected: 'Templates, Sequence, Teams, AzureActiveDirectory, Drive, ProvisioningWebhooks' in namespace 'http://schemas.dev.office.com/PnP/2021/03/ProvisioningSchema'. Add-PnPListFoldersToSiteTemplate: Invalid template file.

This apparently is caused by the Preferences element in the template XML file:
image

Removing the Preferences element fixes the error. Maybe the schema is out of date? Or ist this a version mismatch (1.6 vs 1.7)?

PnP.PowerShell has version v1.7.0 (latest as of writing this)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented Get-PnPSiteTemplate and Add-PnPListFoldersToSiteTemplate commands with the generated template.xml. Inspect how the Provisioning schema handles the Preferences element and compare that with the 1.6 and 1.7 versions mentioned. Done means folders can be added to the Documents list without the invalid child element or invalid template errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.