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 E-mail with attac...
Power Apps
Answered

Send E-mail with attachments from sharepoint list

(1) ShareShare
ReportReport
Posted on by 88
Dear Power Apps community

I'm trying to send an e-mail from powerapps, with in the attachments a file from a sharepoint list.
This is to make it possible for employees to send certain documents to their email address from a local computer on the production site.

(note: i'm Dutch, so names of documents, buttons and so on could sometimes be in the dutch language, but i work in the englisch version of powerapps)

I have a gallery called Galerij_Documenten
Items value is InfoKioskInteressanteDocs (a sharepoint list)
This Sharepoint list has a couple of columns:
- LblSoortDocTitel with item ThisItem.TitelLink
- LblWelkDocTekst with item ThisItem.'Uitleg link'
- DataCardValueDocs with item ThisItem.Attachments

Everything works fine for now.
I have a button in the gallery with the following onselect formula
Clear(Attachment);
Collect(Attachment,DataCardValueDocs.Attachments);
Office365Outlook.SendEmailV2(
    EmailadresInput.Text,
    LblSoortDocTitel.Text,
    LblWelkDocTekst.Text,
    {
        Attachments:
        RenameColumns(
            Attachment,
            "Value", "ContentBytes"
        )
    }
),

If i only do the first part of Collect(Attachments ...) i have in my collections 'Attachments (Table 2 Rows)
If i click on view table i get 2 columns
Name and Value

But i get an error on this part of the formula of the button:
RenameColumns(
            Attachment,
            "Value", "ContentBytes"
        )

The error is the following:
Missing column. Your formula is missing a column 'Attachments.ContentBytes' with a type of 'Blob'.

Is my 'renamecolumns' formule wrong?
Of what can i do to fix this type of 'Blob'?
I was working with this video as my guide:
https://www.youtube.com/watch?v=849WRw65JBo&t=1s

Thank you in advance!

​​​​​​​Greetings Miguel
I have the same question (0)
  • Suggested answer
    WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at
    Firstly you do not need quotes "" around RenameColumns parameters. Also you do not need the "one use" collection.
    Office365Outlook.SendEmailV2(
       EmailadresInput.Text,
       LblSoortDocTitel.Text,
       LblWelkDocTekst.Text,
       {
          Attachments:
          RenameColumns(
             DataCardValueDocs.Attachments,
             Value, 
             ContentBytes
          )
       }
    )
     
    Please click 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 giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • MiguelDeNeve Profile Picture
    88 on at
     
     
    Hi @WarrenBelz
     
    I tried your suggested answer.
    I changed the code from this
    Clear(Attachment);
    Collect(Attachment,DataCardValueDocs.Attachments);
    Office365Outlook.SendEmailV2(
        EmailadresInput.Text,
        LblSoortDocTitel.Text,
        LblWelkDocTekst.Text,
        {
            Attachments:
            RenameColumns(
                Attachment,
                "Value", "ContentBytes"
            )
        }
    ),
     
    To this 
    Office365Outlook.SendEmailV2(
       EmailadresInput.Text,
       LblSoortDocTitel.Text,
       LblWelkDocTekst.Text,
       {
          Attachments:
          RenameColumns(
             DataCardValueDocs.Attachments,
             Value,
             ContentBytes
          )
       }
    )
     
    But then i get this error:
     
     
     
     
    If i do use the whole formula, i get the following error:
    Clear(Attachment);
    Collect(Attachment,DataCardValueDocs.Attachments);
    Office365Outlook.SendEmailV2(
       EmailadresInput.Text,
       LblSoortDocTitel.Text,
       LblWelkDocTekst.Text,
       {
          Attachments:
          RenameColumns(
             DataCardValueDocs.Attachments,
             Value,
             ContentBytes
          )
       }
    )
     
    Do you maybe know how i can fix this?
    Is what i'm trying to do too dificult for powerapps to achieve?
    Or are there any alternatives?
  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at
    The code is correct - I use it regularly in prod apps - I constructed a model with your exact control names as below and received the email as expected
     
    The error you are getting  suggests the content is empty or invalid. What is the Items of this ?
     
  • MiguelDeNeve Profile Picture
    88 on at
    Hello @WarrenBelz
     
    Thank you for your quick response! :)
     
    The Items of DataCardValueDocs is ThisItem.Attachments
    This way it shows in the gallery the right column contents.
     
    Am i overlooking something?
    Or do i need to change something small?
  • MiguelDeNeve Profile Picture
    88 on at
    Hi @WarrenBelz
     
    I also tried it out of a gallery, as you did.
    I found out that if i change the textinput to the classic it works outside of a gallery.
    If i work inside of a gallery, it keeps telling that the attachments are empty.

    It seems i am overlooking something that you did right:

  • Verified answer
    WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at
    OK- I see the issue - I did not realise you were trying to the this inside a gallery - I assumed it was in a Form. Although what you have done technically should work, it simply does not. You need another step to open a Form with the selected record (you can hide the attachment control) and have a button to send the email.
  • MiguelDeNeve Profile Picture
    88 on at
     
    I will try to link the gallery with a form when i select a row.
     
    In that form i will attach everything.
     
    Thank you for the advice :)

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 765 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 272

Last 30 days Overall leaderboard