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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Send photo/image from ...
Power Apps
Answered

Send photo/image from sharepoint list to outlook email

(0) ShareShare
ReportReport
Posted on by

Hi power app community, 

My name is Aleksei and i am buildng my first power app,

So, my scenario is: 

Users fill out a survey, take a multiply photo's and submit it to the sharepoint list.
Next step they can send their survey by mail (with photo attachment),
And i cant attach photos to e-mail =( 


I tried the method from (https://powerusers.microsoft.com/t5/Building-Power-Apps/send-image-via-email/mp/198448/highlight/true#M64181)
but nothing worked, can you explain to me where I went wrong?

 

Set(_emailRecipientString; Concat(MyPeople; Mail & ";"));;
Office365Outlook.SendEmail(_emailRecipientString; TextEmailSubject1.Text; TextEmailMessage1.Text & HtmlTable.HtmlText;
{Attachment:
ShowColumns( 
RenameColumns(QuizCollection;"Photo";"ContentByte";"Title";"Name");"Name";"ContentByte");Importance:"Normal";IsHtml:true});;

 

I try to add an empty 

@odata.type

column, but it didn't work too, 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    Please consider changing your Formula to the following:

    Office365Outlook.SendEmailV2(
     Concat(MyPeople; Mail & ";"); 
     TextEmailSubject1.Text; 
     TextEmailMessage1.Text & HtmlTable.HtmlText;
     {Attachments:
     ForAll(QuizCollection; 
     {Name: Title; ContentByes: Photo}
     );
     Importance:"Normal"
     }
    );;

    This should give you what you are looking for.

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    on at

    Hi, thank you for your reply,

    But, it didn't work for me, 

    So, let me try to explain better
    My sharepoint list is:

    PhotoTitleColumnToFilter

     

    In this e-mail i need to send a table: 

    QuestionAwnser

     

    and attach photos in e-mail. 

    I try to use ur advise: 

     

    Set(_emailRecipientString; Concat(MyPeople; Mail & ";"));; 
    Office365Outlook.SendEmail(_emailRecipientString; TextEmailSubject1.Text; TextEmailMessage1.Text & HtmlTable.HtmlText;
    {Attachment: 
    ForAll(Filter(QuizCollection;Title = ViewReportFromGallery.ColumnToFilter);
    {Name: Title; ContentByte: Photo})
    ;Importance:"Normal";IsHtml:true});; 
    Reset(TextEmailSubject1);; 
    Reset(TextEmailMessage1);; 
    Clear(MyPeople)

     

     
    did't work=( 

    Show that's element;s work separately in power app:

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    You did not use the formula that I provided.  You are using a deprecated function (SendMail) the formula I provided uses the current SendMailV2 function.

     

    Please revise to the formula provided (now amended with your additional functions) :

    Office365Outlook.SendEmailV2(
     Concat(MyPeople; Mail & ";"); 
     TextEmailSubject1.Text; 
     TextEmailMessage1.Text & HtmlTable.HtmlText;
     {Attachments:
     ForAll(QuizCollection; 
     {Name: Title; ContentByes: Photo}
     );
     Importance:"Normal"
     }
    );;
    Reset(TextEmailSubject1);
    Reset(TextEmailMessage1);
    Clear(MyPeople)

     

  • Community Power Platform Member Profile Picture
    on at

    @RandyHayes Thank you,

    But, it didn't help too, 
    Now i use ur formula correctly (sorry, that i change it in previous time)

     

     

    Office365Outlook.SendEmailV2( 
     Concat(MyPeople; Mail & ";");
     TextEmailSubject1.Text; 
     TextEmailMessage1.Text & HtmlTable.HtmlText;
     {Attachment: ForAll(
     Filter(QuizCollection;Title = ViewReportFromGallery.ColumnToFilter); 
     {Name: Title; ContentBytes: Photo} ); 
     Importance:"Normal"
     });;
    Reset(TextEmailSubject1);;
    Reset(TextEmailMessage1);;
    Clear(MyPeople)

     

     

    And this didn't work, 

    I try to not filter sharepoint list but - it didn't help at all, 

     

    May be my problem from "Photo" format? 

    Sharepoint column "Photo" is like:  
    " data: image/png;base64, iVBOR ..."

     

    P.S.

    Can u explain, 

    What's right in attachment: 
    ContentBytes / ContentByes / ContentByte,

    (I google it, and found 3 different variance of this)

     

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    ContentBytes is the correct column name for the attachments.

     

    What is the error you are getting or action that is not happening?

  • Community Power Platform Member Profile Picture
    on at

    @RandyHayes 
    Power app sending e-mail with correct subject/body (with html table) and etc., but without attachment (screenshot in attachment) =(, 

    May be rus language name is not supported yet? (screenshot with table in attachment)
    UPD: Change "name" to number - didn't work =(

    Again, thank you for helping)

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    Well, one of the changes you might need in this is to actually supply a file name extension.

    You are definitely getting results in your ForAll to supply to the function, so that should be working.

    Office365Outlook.SendEmailV2( 
     Concat(MyPeople; Mail & ";");
     TextEmailSubject1.Text; 
     TextEmailMessage1.Text & HtmlTable.HtmlText;
     {Attachment: ForAll(
     Filter(QuizCollection;Title = ViewReportFromGallery.ColumnToFilter); 
     {Name: Title & ".png"; ContentBytes: Photo} ); 
     Importance:"Normal"
     });;
    Reset(TextEmailSubject1);;
    Reset(TextEmailMessage1);;
    Clear(MyPeople)

    Although usually if you don't supply an extension, it still sends the attachment, there is just knowing on the client (outlook) side how to open the file.

     

    So try that, then, if no luck, let's rule out the file name issue all together with this formula:

    Office365Outlook.SendEmailV2( 
     Concat(MyPeople; Mail & ";");
     TextEmailSubject1.Text; 
     TextEmailMessage1.Text & HtmlTable.HtmlText;
     {Attachment: 
     With({_itms:Filter(QuizCollection;Title = ViewReportFromGallery.ColumnToFilter)};
     ForAll(Sequence(CountRows(_itms));
     {Name: Text(Value) & ".png";
     ContentBytes: Last(FirstN(_itms; Value)).Photo;
     }
     )
     )
     Importance:"Normal"
     }
    );;
    Reset(TextEmailSubject1);;
    Reset(TextEmailMessage1);;
    Clear(MyPeople)

    This should send attachments with a sequential file name and png extension.

  • Community Power Platform Member Profile Picture
    on at

    @RandyHayes 
    That didn't solve the problem, I still have emails without attachments ...
    By the way - this is a great formula - thank you!

     

    Maybe I should change something in the Outlook/Sharepoint admin settings or do something else ... )
     

     

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    (*smack to head*)  

    I don't know why it didn't trigger my brain properly when I saw it...you do have your images as base64 encoded images in your list.

    The formulas I've provided will NOT work with that.

    The problem is that you need to get the base64 encoded image back into a binary form in order to attach it.

     

    So...there are two ways:

    1) Skip the attachments and instead embed the images in your html of the email.  If the purpose is for receivers of the email to be able to store the images again from the attachment, then this will not be practical as they would need to right click on all the embedded images and do a save as.

    But, if your need is to only send an email with pictures in it, then embedding is actually preferred over attaching in this case.

     

    2) Convert the images back to binary.  

    There is no function in PowerApps to do this, but you can hack one together.

    If you create a Gallery (let's call is galImages) and set the Items property to the following:

        Filter(QuizCollection;Title = ViewReportFromGallery.ColumnToFilter)

    Put an Image control in the Gallery (let's call it Image1), and set the Image property of Image1 to ThisItem.Photo

     

    Now, Change the formula of your email sending to the following:

    Office365Outlook.SendEmailV2( 
     Concat(MyPeople; Mail & ";");
     TextEmailSubject1.Text; 
     TextEmailMessage1.Text & HtmlTable.HtmlText;
     {Attachment: 
     ForAll(galImages.AllItems;
     {Name: Title & ".png";
     ContentBytes: Image1.Image;
     }
     );
     Importance:"Normal"
     }
    );;
    Reset(TextEmailSubject1);;
    Reset(TextEmailMessage1);;
    Clear(MyPeople)

     

    This should send the base64 encoded images converted back to binary as an attachment(s).

     

    By the way, galImages does not need to be visible, so you can just use it as a helper control in this case.

  • Community Power Platform Member Profile Picture
    on at

    @RandyHayes 

    I try 2-nd approach, 

    So, formula do not see the the image cod (ContentBytes):

    Aleksei__0-1619677517758.png


    About gallery: 

    Aleksei__1-1619677658735.png

    May be i need to use sharepoint flow? 
    P.S.

    I'm ashamed that I took so much of your time)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard