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 / Send email from Powera...
Power Apps
Unanswered

Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

(0) ShareShare
ReportReport
Posted on by 96

Hello,

 

I would like to

  • send Emails 
  • directly out of PowerApps-
  • with one attachment
  • attachment located in a folder in a SharePoint Library.
  • I would not like to do a workaround with flow!

Sending Emails works fine, but to get the attachment produces an error.

 

I would not like to do a workaround with flow!

 

SharePoint Library is called "Export" and added as connection.

 

 

ClearCollect(FinalAttachments, {Name:Export.Name, ContentBytes:FileContent,'@odata.type':""})

;
Office365.SendEmailV2(

     "My@email.com",

     "Test Subject",

     "Test Body",{Attachments: Name: FinalAttachments.Name,ContentBytes:FinalAttachments.ContentBytes, '@odata.type':""})

 

 

Mainly I get the error that contentbyte 'blob' is expected and not record...

 

 

Isn't there an easy way to get the file directly from the library connection instead of a collection? And really, what is it about contentbyte??? I cannot find any reasonable description in the microsoft docs about it...

Categories:
  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @FastTrack ,

    Try this

    Office365.SendEmailV2(
     "My@email.com",
     "Test Subject",
     "Test Body",
     {
     Attachments:
     AddColumns(
     RenameColumns(
     Gallery1.Selected.Attachments,
     "Value",
     "ContentBytes"
     ),
     "@odata.type",
     ""
     )
     )
    }

     

    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.

  • FastTrack Profile Picture
    96 on at

    @WarrenBelz 

    Thank you, but the Attachment is in a dedicated SharePoint library, always the file "mail.jpg" in a unique folder of this library. Files are not in a gallery of my PowerApps

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    @FastTrack ,

    I was simply correcting the syntax of your code, which is referring to an attachment.

    I do not believe there is a way of "pulling" file content from a SharePoint Library and attaching it without a Flow as the Power Apps connection to the library only includes the metadata, not the content of the file.

     

    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.

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @FastTrack ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

  • FastTrack Profile Picture
    96 on at

    Hi @WarrenBelz ,

     

    I could not get your solution to work, so the topic is still open.

     

    Clearly as you can add a SharePoint Library as DataSource in PowerApps it must be possible to somehow get hold of the content directly without adding it to a collection, renaming columns and setting content bytes and all the other weird stuff...

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    @FastTrack ,

    Unfortunately, it is not clearly possible, if you collect the Library, you will not see the actual content of the file in any of the fields.

    You asked a question and I tried to answer it.

  • pchettri Profile Picture
    39 on at

    Hi there, even im stuck with same issue, reason being im not using flow, I have list of files saved in SP library, and im not sure how to send the correct file. Can anyone suggest if we can send only selected files in flow ?

  • RBoneck Profile Picture
    435 on at

    Is your code usable when attaching multiple documents from a gallery? I want to attach every file in the gallery, or just use the filter that's in that gallery, but I'm not sure how to not use a selected item. 

    Office365Outlook.SendEmailV2(
     DataCardValue_EmailSendTo.Text, 
     DataCardValue_EmailSubject.Text, 
     DataCardValue_EmailBody.Text, 
     {
     Cc: Coalesce(DataCardValue_EmailCC.Text, ""),
     Attachments: 
     AddColumns(
     RenameColumns(
     PODocuments_Gallery.AllItems,
     "Value",
     "ContentBytes"
     ),
     "@odata.type",
     ""
     )
     }
    );

     

    I get multiple errors with that code, including "The specified column 'Value' does not exist". Can you point me in the right direction?

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    @Boneckrh19 ,

    That code is for adding attachments, not gallery items (which you cannot do)

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard