web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Attach SharePoint Doc...
Power Apps
Answered

Attach SharePoint Document to Email Using Office365Outlook.SendEmailV2 in PowerApps

(0) ShareShare
ReportReport
Posted on by 38

Hi everyone,

I have a PowerApp where the OnSuccess property of a form control triggers two actions:

  1. It sends an email using the Office365Outlook.SendEmailV2 connector.

  2. It also triggers a Power Automate flow that generates a Word document and attaches it to the corresponding SharePoint list item.

Now, I’d like to enhance the email sent via SendEmailV2 by including the Word document created by the flow as an attachment.

Has anyone done this before or could provide guidance on:

  • How to retrieve the document from the SharePoint list item within PowerApps?

  • How to attach that document to the email using Office365Outlook.SendEmailV2?

Any examples, steps, or best practices would be greatly appreciated!

Categories:
I have the same question (0)
  • Suggested answer
    WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
    By far the easiest way would be to send the email via Powr Automate after you produce the Word document and simply attach the content to the mail. Probably techically possible to return some base64 from the flow, but not worth the complexity and effort if you can simply send the email from the Flow (just add the details in the Flow parameters).
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful?
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,969 Moderator on at
     
    I do normally try to stay off @WarrenBelz 's posts unless I really feel the need to add something.
     
    My guess is you are sending the email from the App because you want the email to go out as the user. This is not easy to do if you send the email from Power Automate because you either have to use Delegation and Graph API (which is a pain) or grant the person who created the connection in the flow, Send rights to every person who might send an email or use Shared Mailboxes. 
     
    If you can use a Shared Mailbox then you can do as Warren mentioned and it would technically be easier, but for tracking purposes you would lose all of that due to the user not being the one who sent the email.
     
    My guess is this is why you want to attach it to the Send Email in the flow so that it will be the same as the individual correct?
     
    I'd like to validate, that this is something you attached to an item in SharePoint and not a Document library as there is a difference and an important validation part.
     
    As for attaching the email, first you need to bytes, so either
    1) send the data back
    2) if the record you are creating is based on a Form, you can use the attachment control
    3) pass back the Item ID of the Item you attached to and the attachment identifier to your canvas app
     
    Then use that to grab the attachment and attach it to the email.
     
    There are examples of how to do that so I'm not going to write one but you can look at some
     
    If you do not care about who sends the email, meaning it can always go out as the Connection owner, then I would follow what @WarrenBelz said and look at just doing it all from the Flow.
     
     
    P.S. depending on how you store (attachment versus document library you can also just send a link). And in your Item, instead of attaching, map the Document Id to the Item row with a column (not a lookup). then grab the URl of the document via that and add the link to the outgoing email versus attachments.
     
    Cheers

    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
    I think we are both reading the question differently - not sure who is correct.
     
    In one of my prod apps, the user executes a process of generating a PDF from a Word Template and attaching it to an email.
    I send some parameters to the Flow,
    • The ID of the target record (I get most of the Word template content from this record),
    • A couple of other variable parameters
    • The email's desired recipient/s. 
    The Flow generates the Word merge and then the PDF and emails the resulting file to the required destination/s. So this process requres no special permission except the user would need the appropriate licence for the Premium Word connector. As this flow is already being run by @Power_Ninja, I assumed that exists.
     
    However I had another thought after reading your suggestions if the email really for whatever reason needs to come from Power Apps. You can certainly do this in two steps (the file then the email) by doing what you suggest and attaching the file to a identified record. You would then have an attachment control on the screen and get the Email content from Last(AttachmentControl.Attachments).Value.
     
    I mention two steps as both the data source and the attachment control need to refreshed after the Flow has run. To do this, add Respond to a Power App or Flow to the end of the Flow and set a Variable to this value. The Variable does not matter, but this forces Power Apps to wait until the Flow is finished executing before proceeding with any following code. You could then refresh the data source and reset the Attachment control before running the email code with the attachment.
  • Michael E. Gernaey Profile Picture
    53,969 Moderator on at
     
    Yes, that is one of the option in the link I sent (using an attachment). The issue I see is that the outlook connection cannot be delegated to someone else, that's why I assumed they wanted to send it from the app, so the From would be from the actual App user, where-as if you send it from Power Automate it would be from whomever setup the connection, unless it uses Send As permissions.
     
    So yes, if @Power_Ninja setup the flow you are correct, I am so used to them lol not being the person, I should not assume its not them hehe, I just kinda took the leap since they were sending the email from the App, versus the flow, and that was my only logical reason to think that.
     
    I definitely agree, if it can all be done in the flow, I would too, as long as they are the only ones using the app, otherwise then anyone else using it would still send as @Power_Ninja instead of themselves.
     
    BTW haha sorry @Power_Ninja for stealing hehe part of your thread @WarrenBelz I am really hoping we could do something together :-) I don't know what yet hehe but something.
     
    Cheers!!!
  • Verified answer
    WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
    I may be missing somehting here, but the Outlook connector in a Flow is run by default in the context of the user's connection in Power Apps (unless the Run only user on the connector in the Flow is redirected to another connection in the environment). So the email will by default come from the user logged into Power Apps (the From: will be the user).
    If you want the mail to come from a different (shared) Mailbox, you can of course also use Send As from this account as long as the user has send delegation in that mailbox (this can be done from either the Flow or Power Apps).
  • Power_Ninja Profile Picture
    38 on at
    Thank you both for your input. This app has been in use for around 30+ users successfully for the past 2 years so I was hesitant to move away from sending the email through the app but I can see it might be to difficult to feedback the correct content for the attachment through the flow I've created. I think I'll leave the email as it currently is with the information from the Power App and associated distribution lists and send a separate email from the flow.
  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
    It is really not that much of a change to send the email from a flow - a couple of my apps do hundreds weekly and have attachments either retreived or generated by the Flow - I do far more emails from flows than from Power Apps.
    Anyway, if your solution works for your business process, then that is a good thing.
    Also thank you @Michael E. Gernaey for your input - two minds always set the grey matter in motion better. Happy to collaborate on something in the future.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard