Skip to main content

Notifications

Community site session details

Community site session details

Session Id : X27PLcbnbvkuxKWz7rAuLb
Power Automate - Building Flows
Answered

I need to add a button to a SharePoint page to send an email.

Like (0) ShareShare
ReportReport
Posted on 11 Jan 2023 21:27:43 by 428

Updated with partial solution.

I found that by using the trigger "When an HTTP Request is received" I can paste that URL into my button. Cool. Now I just need to figure out how to get the data from the person pressing the button. 

- - - - - - 

 

My thought was to create a flow in PowerAutomate so when a button is pressed it sends a pre-scripted email from the person pressing the button.  The directive is to confirm that someone has reviewed the page. 

 

I've tried using Manually Trigger a Flow but, even though I was able to get the URL for this button, it needs to open another page to 'run the flow'.   

 

I was also thinking about creating a Form to trigger this process but having the whole form on a page is not ideal.  

 

I've also considered creating a power app to embed on the page but I'm not sure about all that. 

  • D365_Community Profile Picture
    6 on 24 Jan 2023 at 11:46:24
    Re: I need to add a button to a SharePoint page to send an email.

    @Expiscornovus  I have tried your method and it's very nice but I have a question, when you click the button it opens a blank page to the user with the URL we have entered can we put a note or a message inside just not to confuse the user of what's this.

    And thank you for your effort.

  • anthonys123 Profile Picture
    428 on 16 Jan 2023 at 19:31:35
    Re: I need to add a button to a SharePoint page to send an email.

    Nice. This little code snipet really made a huge difference. Thank you for the help. 

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
     "hideColumnHeader": true,
     "hideSelection": true
    }

     

     

  • Verified answer
    Expiscornovus Profile Picture
    31,648 Most Valuable Professional on 14 Jan 2023 at 13:02:20
    Re: I need to add a button to a SharePoint page to send an email.

    Hi @anthonys123,

     

    Yes, that would probably be the easiest approach for retrieving the emailaddress of the current person without any coding. That's why I suggested this approach to you.

     

    But you are right, it would not be exactly the same as that other thread.

     

    You do need to change it to your specific setup/requirements 😁

     

    Btw, you can place a list web part on a page and with column & view formatting you can format it as a single button (if you just use a single item in the list).

     

    Below is an example which hopefully clarifies why I think this approach is still suitable for your situation.

     

    1. I create a list called Single Button Click, only with the title column. Add one list item to it. Does not matter what title value you use. We are going to reformat it anyway with the txtcontent button in the column formatting.

     

    2. Add column formatting to the Title column. Use the json below.

     

     

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
     "elmType": "button",
     "style": {
     "border-radius": "5px",
     "margin": "5px 0px",
     "padding": "0px",
     "visibility": "visible"
     },
     "attributes": {
     "class": "ms-bgColor-themePrimary"
     },
     "children": [
     {
     "elmType": "a",
     "txtContent": "Click Me",
     "style": {
     "text-decoration": "none",
     "padding": "10px 0px",
     "width": "100%"
     },
     "attributes": {
     "href": "='https://prod-30.yourregion.logic.azure.com:443/workflows/workflowguid/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=randomsig&username=' + @me",
     "target": "_blank",
     "class": "ms-fontColor-white"
     }
     }
     ]
    }

     

     

    3. Add view formatting to the All Items view (to hide the column headers and selection options). Use the json below

     

     

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
     "hideColumnHeader": true,
     "hideSelection": true
    }

     

     

    4. Place the list web part on the page and make sure you select your List and hide all the controls

     

    button_clickme.PNG

     

    The end result should look something like below on a page.

     

    button_clickm.PNG

     

    That being said, obviously feel free to go down the deploy custom web part with javascript approach, if you feel comfortable coding. And the above is still not what you are looking for?

     

     

    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel
  • anthonys123 Profile Picture
    428 on 13 Jan 2023 at 17:09:14
    Re: I need to add a button to a SharePoint page to send an email.

    I'm sorry if I'm not understanding... you are offering a solution for a LIST when I'm asking about a PAGE and you already know that the solution for one is not the same as the solution for the other? 

  • Expiscornovus Profile Picture
    31,648 Most Valuable Professional on 13 Jan 2023 at 16:52:07
    Re: I need to add a button to a SharePoint page to send an email.

    Hi @anthonys123,


    Yes, that is correct. In that other thread I originally proposed a button via column in the list (via column formatting and the '@me' string value). That's also what I am suggesting for you 😀

     

    However, the poster in that other thread asked if it was also possible to just have a single button instead of embedding it into the list (new requirement).

     

    That's why in the end of the thread you see the discussion about a different approach to meet that new requirement 😁

  • anthonys123 Profile Picture
    428 on 13 Jan 2023 at 16:41:26
    Re: I need to add a button to a SharePoint page to send an email.

    So, am I correct in understanding the solution you're providing is for a SharePoint List? It looks like at the bottom of that thread you've directed them to a script editor to add a button to a Page. 

  • Expiscornovus Profile Picture
    31,648 Most Valuable Professional on 12 Jan 2023 at 09:52:21
    Re: I need to add a button to a SharePoint page to send an email.

    Hi @anthonys123,

     

    Recently I suggested a similar type of approach in this thread:

    https://powerusers.microsoft.com/t5/Building-Flows/Get-User-Details-from-a-quot-When-a-HTTP-request-is-received/m-p/1939186/highlight/true#M213545

     

    You could add parameters at the end of your URL (&customparameter=value) which can be retrieved within the flow via an expression like:

    triggerOutputs()['queries']['customparameter']

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,710 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,045 Most Valuable Professional

Leaderboard