Pnpjs: How to create folder with custom content type in document library

Created on 6 Mar 2019  路  2Comments  路  Source: pnp/pnpjs

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

Hello. I need little help to solve my problem.
I have Document Library. In this library I have my two custom content types which are inheriting from Folder Content Type.
I have prepared custom application which can create programmatically These types of custom folders. My Custom Content Types has more fields no only name but also for example Department...
I know that in PNP we can addItem and Specify the ContentTypeID and Item will be directly created with this content type....But what about Folders in Document Libraries?
How to add Custom Content Type Folder to Document Library with specific ContentType by PNP?....
Thank you very much for your help.

sample answered question

Most helpful comment

Hi @enti333,

The folder can be created first using a default content type, then the folder associated item's content type can be changed to the required (see more).

A custom content type can be added to a list or lib using list.contentTypes.add.

All 2 comments

Hi @enti333,

The folder can be created first using a default content type, then the folder associated item's content type can be changed to the required (see more).

A custom content type can be added to a list or lib using list.contentTypes.add.

I was thinking that you will say this:) That means three calls. That's not a problem :)
Thank you Andrew.

Was this page helpful?
0 / 5 - 0 ratings