You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What SharePoint development model, framework, SDK or API is this about?
💥 SharePoint Framework
Target SharePoint environment
SharePoint Online
What browser(s) / client(s) have you tested
💥 Internet Explorer
💥 Microsoft Edge
💥 Google Chrome
💥 FireFox
💥 Safari
mobile (iOS/iPadOS)
mobile (Android)
not applicable
other (enter in the "Additional environment details" area below)
Additional environment details
No response
Issue description
So basically I'm currently trying to create a new sharepoint page from a template page that I have created earlier, all that using PNPJS. The issue is that I cannot find any way to directly create it from the template like I would do in SharePoint when clicking on the New->Page->Saved on this site->and select the template i need. As far as I read the PNPJS documentation, there are 2 ways of making a new page based on the template page:
loading the template page using loadClientSidePage and using copy function to replicate the template page
the downside of doing it, is that the newly created page is also marked as a template page which I do not need. I tried removing that tag using this approach
// Load the newly created page, and set SitePageFlags to null to remove its 'Template' flag
await sp.web.lists.getByTitle("Site Pages").items.getById(pageId).update({
OData__SPSitePageFlags: null // Removes the template flag
});
while doing that, sharepoint gives an error that the field is not nullable so I have also tried to set it to [], "", ''. Nothing helped
creating a new page using addClientsidePage, loading the template page, and using copyTo function to copy the contents from template
this approach is a bit different because it does not copy the entire page but only it's contents, the problem with that is that the newly created page does not replicate the layout of a template page etc. which is essential when creating a page from a template (new page has to be the exact copy of a template page but without being a template itself).
so my question is, is there a way to make an exact copy/create a page using a template page so it is the exact same page as a template without it being flagged as a template too? Maybe there is a way of changing the type of a new created page to normal page insted of it being a template?
The text was updated successfully, but these errors were encountered:
What type of issue is this?
Question
What SharePoint development model, framework, SDK or API is this about?
💥 SharePoint Framework
Target SharePoint environment
SharePoint Online
What browser(s) / client(s) have you tested
Additional environment details
No response
Issue description
So basically I'm currently trying to create a new sharepoint page from a template page that I have created earlier, all that using PNPJS. The issue is that I cannot find any way to directly create it from the template like I would do in SharePoint when clicking on the New->Page->Saved on this site->and select the template i need. As far as I read the PNPJS documentation, there are 2 ways of making a new page based on the template page:
the downside of doing it, is that the newly created page is also marked as a template page which I do not need. I tried removing that tag using this approach
while doing that, sharepoint gives an error that the field is not nullable so I have also tried to set it to [], "", ''. Nothing helped
this approach is a bit different because it does not copy the entire page but only it's contents, the problem with that is that the newly created page does not replicate the layout of a template page etc. which is essential when creating a page from a template (new page has to be the exact copy of a template page but without being a template itself).
so my question is, is there a way to make an exact copy/create a page using a template page so it is the exact same page as a template without it being flagged as a template too? Maybe there is a way of changing the type of a new created page to normal page insted of it being a template?
The text was updated successfully, but these errors were encountered: