Pnpjs: Provision List from schemaXML

Created on 15 Dec 2020  路  4Comments  路  Source: pnp/pnpjs

Category

  • [ ] Enhancement
  • [ ] Bug
  • [x] Question
  • [ ] Documentation gap/issue

Version

Please specify what version of the library you are using: [latest ]

Please specify what version(s) of SharePoint you are targeting: [Online]

Question

Is there a pnpjs method to provision a list from an XML template? Basically I am looking for the pnpjs equivalent of pnp powershell Apply-PnPProvisioningTemplate.

I found createFieldAsXml in the documentation, but no method to pass a list schemaXML.

Thank you!

question

All 4 comments

No, there is no full-blown provisioning with PnPjs, one of the reasons is that many provisioning aspects are not represented in REST API or do not work how they should, therefore many operations require CSOM.

There were tries to create sp-js-provisioning, but this project never went far and was (maybe is) only used by initial maintainers within their scoped use cases.

There were other tries, like this.

Site designs, which are covered in REST and PnPjs, can be a closer alternative but with a completely different schema and its limitations: https://pnp.github.io/pnpjs/sp/site-designs/

Thanks for the info! It seems that for my case creating the list shell then adding columns and settings will be good enough.

For the record I was also looking at a WP sample and opened this question.

Would you have any specifics on what does not work as expected? For my scenario, I'll need to break permission inheritance, add a list validation formula, and give item level permissions to "Create items and edit items that were created by the user".

Well, the limitations are around content types and field links. Some props are exposed to REST API as read-only and also ignored when passing within XML schemas. Here and there you'd need to fallback to CSOM after hours of experiments. Many list provisioning scenarios would work and covered, but with using only REST many provisioning aspects won't. If a case is simple it definitely can be done without CSOM.

However, by diving deeper and adding more features you'd face it simpler to host a provisioning backend (Azure Functions + PnP Provisioning engine) and sending a signal to apply a template.

Thanks Andrew, I really appreciate the detailed answer and the pointers.

Was this page helpful?
0 / 5 - 0 ratings