Forum Discussion
Using the REST API to export page layout and web parts to site script
Thanks for your input, Carlos_Marins.
For different reasons I'm using Python instead of Powershell, so I need to find a way to convert your proposed solution over to Python. I'm thinking that the PnP Powershell module likely is talking to the Sharepoint Online's REST or Graph endpoint, so if I can figure out which endpoints there are, I can have my Python code use those endpoints as well. You wouldn't happen to have an idea which REST API endpoint may be involved here?
By the way, I just came across this information from https://support.office.com/en-us/article/create-and-use-site-templates-in-sharepoint-server-versions-60371b0f-00e0-4c49-a844-34759ebdd989?ui=en-US&rs=en-US&ad=US: "The Save site as template option is not supported in SharePoint Server 2019 (modern sites) or SharePoint Online (modern sites)". As I'm using SharePoint Online to create modern sites, maybe working with site templates is a lost case from the get-go. Have you succeeded in creating site templates from SharePoint Online modern sites?
Hey kenneho,
Oh, I don't know if you can really do it using Python. The PnP PowerShell Module uses CSOM AFAIK so not all features available could be translated to REST, although I believe many of them are. Do you have an exact set of features that you need for your site? We can look up if they are available through REST if you do.
About the link with site templates, yeah i have seen that before. It was kind of useful for classic sites, but not for Modern ones.