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 / Powerapps mail attachm...
Power Apps
Unanswered

Powerapps mail attachment from SQL/Blob Storage

(0) ShareShare
ReportReport
Posted on by 5

Hi guys, I've been having some trouble with the following scenario, I recently moved my pdfs from a SharePoint list to a SQL database and have been storing pdfs in a varchar(max) column, this works fine for viewing and saving. However, I now need to send those documents as an email attachment. Using the Outlook365 attachment gives me an error that it is not in blob format. I then created an Azure blob storage container and save the pdfs there, but I do not know how to get the documents from the blob storage into a mail attachment in powerapps, any help would be greatly appreciated

Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @Kollenel26 ,

    Could you please share a bit more about the PDF file data stored in your SQL Table? Is it stored as Blob data?

    Do you want to retrieve all blobs (PDF files) from a specific folder in your Azure Blob Storage, and then attach them as attachments of the email?

     

    Based on the needs that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

    Set the OnSelect property of the "Send Email" button to following:

    Office365Outlook.SendEmailV2(
     "User1@email.com", 
     "Subject Text Here", 
     "Email Body Message Here", 
     {
     Attachments: ForAll(
     AzureBlobStorage.ListFolderV2("Type your Specific Folder Id here").value,
     {
     Name: DisplayName,
     ContentBytes: AzureBlobStorage.GetFileContent(Id),
     '@odata.type': ""
     }
     )
     }
    );
    

    Note: You need to add Office 365 Outlook connection and AzureBlobStorage connection within your app firstly.

     

    More details about sending an email with attachments in canvas app, please check the following article:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections/connection-office365-outlook#send-a-message-with-an-attachment

     

    Best regards,

  • Kollenel26 Profile Picture
    5 on at

    Thanks a million, that works, apologies, I am quite new to all this, so I followed one tutorial where I used the add picture control to upload a pdf and then create a file in my azure blob storage, your method works to send the mail but ideally I would like to select one or more out of a folder. for one component of the app.

    For the next component: I am creating certificates per candidate using a flow, this updates a varchar(max) column in a SQL database with the Muhimbi converted pdf per learner, now I could create a blob for each of them simultaneously and retrieve them using your code, I would just need to figure out how to filter my blob container. Or if I could somehow upload the SQL column data to the blob storage that would be ideal seeing as I could then create and delete once the mail is sent and keep my blob container empty for neatness sake, I am just not so clued up with the data types, the converted pdf is in the form of "JVBERI0XlJ..." which is a massive text file, I am not sure how to upload that as a blob and then get selected ones back again?

    P.S I am using varchar(max) in the SQL table because that is the only way I could get pdfs to display in the pdfviewer in the app, the image type gave all sorts of errors

     

  • v-xida-msft Profile Picture
    on at

    Hi @Kollenel26 ,

    Is the solution I provided above helpful in your scenario?

     

    If you have solved your current problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

     

    If you have another needs within your scenario, please consider open another thread in our forum.

     

    Best regards,

  • wsalling Profile Picture
    114 on at

    Thank you for the help on this.  This has help me down the right road.

     

     

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard