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

Community site session details

Session Id : OdqFDjEKR6HduUqW6KIcsj
Power Apps - Building Power Apps
Unanswered

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

Like (0) ShareShare
ReportReport
Posted on 31 Jul 2020 09:58:29 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
    149,158 Most Valuable Professional on 10 Jul 2023 at 21:55:17
    Re: Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

    @Boneckrh19 ,

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

  • RBoneck Profile Picture
    411 on 10 Jul 2023 at 20:16:26
    Re: Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

    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?

  • pchettri Profile Picture
    39 on 14 Jun 2023 at 07:45:51
    Re: Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

    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 ?

  • WarrenBelz Profile Picture
    149,158 Most Valuable Professional on 03 Aug 2020 at 21:26:05
    Re: Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

    @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.

  • FastTrack Profile Picture
    96 on 03 Aug 2020 at 13:11:33
    Re: Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

    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
    149,158 Most Valuable Professional on 02 Aug 2020 at 02:52:11
    Re: Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

    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.

  • WarrenBelz Profile Picture
    149,158 Most Valuable Professional on 31 Jul 2020 at 11:26:38
    Re: Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

    @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.

  • FastTrack Profile Picture
    96 on 31 Jul 2020 at 11:18:05
    Re: Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

    @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
    149,158 Most Valuable Professional on 31 Jul 2020 at 10:29:13
    Re: Send email from Powerapps with attached file from Sharepoint Library - NO FLOW!

    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.

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete