cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Excel_aint
Frequent Visitor

Office365.SendEmail with or without an attachment ?

My app has some TextInput fields & a Camera1. Currently it works so long as I take a photo, but if I want to send the email without photo attached I get an error on my phone ....Cannot be Null....

I'd really appreciate any suggestions ?

 

See Screen3 btnSend OnSelect code below

Office365.SendEmail(TI_Email,HT_Noted3.HtmlText&" - "&TI_Subject,HT_Details.HtmlText&"<br>"&"<br>"&TI_Details&"<br>"&"<br>"&HT_Request.HtmlText&TI_Request,{Importance:Normal,IsHtml:true,Attachments:Table({Name:"Pic1.jpg",ContentBytes:Camera1.Photo,'@odata.type':""})});UpdateContext({cameraEnabled: !cameraEnabled})

Many Thanks

E

1 ACCEPTED SOLUTION

Accepted Solutions

I would put the images into a collection, then do an If statement based on count rows.

If(countrows(collections)>0, send email with attachment, send email without)

View solution in original post

7 REPLIES 7
leyburn19
Memorable Member
Memorable Member

Watch these two videos made by Shane Young.  They should help you

 

https://www.youtube.com/watch?v=ycPO7Y3Cyu0&t=1448s

 

https://www.youtube.com/watch?v=V3feURQfY3M&t=721s

Thanks leyburn19.

I'd already seen Shane's videos but he doesn't explain how to sendemail without an attachment. Somewhere in the Send Button OnSelect property I guess there would have to be an If statement something like  If(there is a photo, send email with photo, else send email without photo) but I don't know how to do that.

 

This is what I've been experimenting with..

Office365.SendEmail(TI_Email,HT_Noted3.HtmlText&" - "&TI_Subject,HT_Details.HtmlText&"<br>"&"<br>"&TI_Details&"<br>"&"<br>"&HT_Request.HtmlText&TI_Request,{Importance:Normal,IsHtml:true,Attachments:Table({Name:"Pic1.jpg",ContentBytes:Camera1.Photo,'@odata.type':""},{Name:"PenInput.jpg",ContentBytes:PenInput.Image,'@odata.type':""})});UpdateContext({BlankImage: PenInput.Image})

Thanks

E

 

I would put the images into a collection, then do an If statement based on count rows.

If(countrows(collections)>0, send email with attachment, send email without)

Where do I put the If statement ?

Where ever you actually have your send email command. I’m assuming you must do this based on the button or something
Anonymous
Not applicable

Thanks for your help with this thread @leyburn19!

 

@Excel_aint are you still getting the error message you described above?

 

@Anonymous

No. My If statement is about a page long. It's not pretty, but it works.

E

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,429)