SharePoint.DefaultWebPart enum #418
-
Hi There, when trying to add web parts to a modern page I noticed the document library web part is not listed in the DefaultWebPart enum. Is that by design? I found the doc library manually from the Page.AvailablePageComponentsAsync, however if I add it to the page the web part does not load correctly when viewing the created page. I used the workbench 'web part data' to pre-configure a doc library web part and grabbed the properties and added it to the .PropertiesJson. However it failed to load. Can add other web parts using the enum above. https://pnp.github.io/pnpcore/using-the-sdk/pages-webparts.html |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I've actually figured this out. I noticed the webpart ID was different on a doc library when I grabbed the metadata from the workbench to the id of the Doc library web part found from the AvailablePageComponents but it did match the PnP.Core.Model.SharePoint.DefaultWebPart.List enum (aka ID f92bf067-bc19-489e-a556-7fe95f508720). So changing to use this and it worked, and can now add a doc library web part to the Page. Awesome! |
Beta Was this translation helpful? Give feedback.
I've actually figured this out.
I noticed the webpart ID was different on a doc library when I grabbed the metadata from the workbench to the id of the Doc library web part found from the AvailablePageComponents but it did match the PnP.Core.Model.SharePoint.DefaultWebPart.List enum (aka ID f92bf067-bc19-489e-a556-7fe95f508720). So changing to use this and it worked, and can now add a doc library web part to the Page. Awesome!