Modern SP Button to automatically create SitePage using template

Asfandyar 6 Reputation points
2021-07-06T10:10:13.907+00:00

In classic SharePoint, we had a custom coded button which would bring up a pop-up (below), take inputs, automatically create a SitePage with the required folders by copying a projects template sitepage, and use that newly created Projects page URL to create a new item within a list of projects.

112039-image.png

This would be the result:
112116-image.png

----------

In the process of making a modern SP Homepage, I can add a button and link it to the default New Project button within the List which brings up the following options:

112159-image.png

The previous button automatically did the steps of creating a new site page and filling in the Projects URL section of this. My question is:

How can I create a button to automate a task such as creating a new SitePage from a template, and use that URL to create a new List item in Modern SharePoint?
Previously this was done in a very complicated and convoluted way using SharePoint designer and I don't want to replicate that.

  • Can I use some REST API Calls or PowerShell scripts?
  • If so, or any other such method, how would those be linked to a button on the Sharepoint Homepage itself?
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,300 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,810 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,026 Reputation points
    2021-07-07T06:39:51.677+00:00

    Hi @Asfandyar ,

    As a workaround, you could create a Power Automate/flow to automate the task(create a new SitePage from a template, and use that URL to create a new List item).

    In the flow, you could use REST API Calls to create a sitepage by copying a template sitepage.

    Then you could link the flow page to the button on SharePoint page.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments