Forum Discussion

ATB1999's avatar
ATB1999
Frequent Visitor
1 year ago
Solved

Setting up a draft email dynamically on each user's clicking on a Power Automate Button

Hi there.   For the past days, I have been assessing the feasibility of a workflow on a Power BI report on which I would like your input. Basically speaking:   I have a Power BI report with a ta...
  • v-hashadapu's avatar
    1 year ago

    Hi ATB1999 , Thank you for reaching out to the Microsoft Community Forum.

     

    This isn’t possible using Power BI and Power Automate alone, because flows run under the creator’s account, so actions like drafting an email will always affect your mailbox, not the user's.

     

    The only way to draft the email in the clicking user’s inbox is by using the Microsoft Graph API with delegated permissions, which allows actions to run as the signed-in user. You can capture the user’s email in Power BI using USERPRINCIPALNAME(), then pass it to a flow via a button parameter. Inside the flow, format your table as HTML and use an HTTP action to call: POST https://graph.microsoft.com/v1.0/me/messages with a request body that sets isDraft: true. This creates the draft in the signed-in user’s mailbox.

     

    To make this work, you'll need to register an Azure AD app with Mail.ReadWrite (delegated) permission and either use a custom connector or trigger the flow from Power Apps, which runs in the user’s context.

     

    If this helped solve the issue, please consider marking it “Accept as Solution” and giving a ‘Kudos’ so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.