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 / How to add LastSubmit....
Power Apps
Answered

How to add LastSubmit.Attachments in Email?

(0) ShareShare
ReportReport
Posted on by 28

In order for my form to submit with the correct data via email and SharePoint list, I have to use "LastSubmit" instead of "DataCardValue".

 

I am able to send all of the data via email and SharePoint list using LastSubmit with an exception of the attachments. How do you send attachments using LastSubmit?

 

Here is my code so far on the OnSuccess property of the form:

Office365Outlook.SendEmailV2(Form1_2.LastSubmit.'Requested By'.Email,

"New Request: " &Form1_2.LastSubmit.Title

, HtmlText1_2.HtmlText,

{Cc: Form1_2.LastSubmit.'Department Manager'.Email &";"& Form1_2.LastSubmit.'Department Director'.Email &";"&Form1_2.LastSubmit.'Hi Acute Director'.Email &";"& Form1_2.LastSubmit.'Business Sponsor'.Email

,Importance: "High"

,Attachments: 
 AddColumns(
 RenameColumns(
 DataCardValue42.Attachments,
 "Value", 
 "ContentBytes"
 ), 
 "@odata.type", 
 ""
 )
 }
);

ResetForm(Form1_2);

  

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @123testing321 ,

    Your problem is that after submitting the Form, the Attachment control content is no longer valid, so try this - to Save

    UpdateContext(
     {
     varAttach:
     AddColumns(
     RenameColumns(
     DataCardValue42.Attachments,
     "Value", 
     "ContentBytes"
     ), 
     "@odata.type", 
     ""
     )
     }
    );
    SubmitForm(Form1_2)

    then OnSuccess

    With(
     {wData: Self.LastSubmit},
     Office365Outlook.SendEmailV2(
     wData.'Requested By'.Email,
     "New Request: " &wData.Title, 
     HtmlText1_2.HtmlText,
     {
     Cc: wData.'Department Manager'.Email & ";" & 
     wData.'Department Director'.Email & ";" & 
     wData.'Hi Acute Director'.Email & ";" & 
     wData.'Business Sponsor'.Email,
     Importance: "High",
     Attachments: varAttach 
     }
     )
    );
    ResetForm(Form1_2);

     

    Please click Accept as solution 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 giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • 123testing321 Profile Picture
    28 on at

    Thanks @WarrenBelz That worked like a charm. Now it sends an email with the attachments. 🙂 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard