Forum Discussion
Setting up a draft email dynamically on each user's clicking on a Power Automate Button
- 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.
Hi ATB1999 , I hope you're doing well! Just checking in to see if you had a chance to review the details shared earlier. If any of the information addressed your needs, feel free to mark it as "Accept as Solution" or give it a 'Kudos' to help others in the community. Please let me know if you have any further questions!