cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Titortian
Level: Powered On

Send an email with an attachment saved on SharePoint

All,

There are a number of other questions similar to this out there and I have read through a couple dozen trying to achieve my goal.

In my app I have a section with generated emails that are sent out requesting quotes from vendors.
I would like to have the BoM attached to the emails as they are sent out.

Each of the BoMs live on our SharePoint site and will always have the same name so the location/file name can be hard coded.
My email form is based on the default email template.

Any assistance would be appreciated.

 

/*Create semicolon separated list of people to email, send the email, reset subject & message fields*/           
Set(
    _emailRecipientString,
    Concat(
        MyPeople,
        Mail & ";"
    )
);
Office365Outlook.SendEmail(
    _emailRecipientString,
    vSANIGNetworkEmailSubjectTextEmailSubject_1.Text,
    vSANIGNetworkEmailBodyTextEmailMessage_1.Text,
    {Importance: "Normal"}
);
Reset(vSANIGNetworkEmailSubjectTextEmailSubject_1);
Reset(vSANIGNetworkEmailBodyTextEmailMessage_1);
Clear(MyPeople)

 

 I understand that I would need to use the following formatting;

 

Office365.SendEmail(inputTo.Text, inputSubject.Text, inputBody.Text, {Attachments:Table({Name:"file1.jpg", ContentBytes:Camera1.Photo, '@odata.type':""})})

 

 What I don't understand is how do I point to a specific location within SharePoint for the attachment.

I assume it has something to do with {Name:"file1.jpg", ContentBytes:Camera1.Photo, '@odata.type':""} however I have no clue how to make this work.

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Send an email with an attachment saved on SharePoint

Hi @Titortian ,

Where do you store your BoM files? SP Library or attached as attachments of SP List Item?

 

If these BoM files stored in your SP Library, and you want to attached them within the email body in your app, I afraid that there is no way to achieve your needs in PowerApps currently.

 

Currently, within PowerApps, there is no way or functions supported to get the file content of the files stored in a SP Library. As an alternative solution, I think the combination of PowerApps and MS Flow could achieve your needs.

 

On your side, you could consider fire a flow from your app, then pass the _emailRecipientString value, vSANIGNetworkEmailSubjectTextEmailSubject_1.Text value, ... to the flow. Then within your flow, send an email based on the passed parameter values from your app. Within your flow, you could consider add a "Get file content" action of SharePoint connector to get file content of the specific BoM file from your SP Library.

I have made a test on my side, please consider take a try with the following workaround:

Flow's configuration as below:

8.JPG

 

 

App's configuration:

9.JPG

 

More details about firing a flow from an app, please refer to the following article or video:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

https://www.youtube.com/watch?v=1wl9AtxWdkg

 

If you want to send multiple files using single one email sent from flow, please check the following thread:

https://powerusers.microsoft.com/t5/General-Power-Automate/Send-all-files-as-attachment-by-email-fro...

 

Please take a try with above alternative solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Send an email with an attachment saved on SharePoint

Hi @Titortian ,

Where do you store your BoM files? SP Library or attached as attachments of SP List Item?

 

If these BoM files stored in your SP Library, and you want to attached them within the email body in your app, I afraid that there is no way to achieve your needs in PowerApps currently.

 

Currently, within PowerApps, there is no way or functions supported to get the file content of the files stored in a SP Library. As an alternative solution, I think the combination of PowerApps and MS Flow could achieve your needs.

 

On your side, you could consider fire a flow from your app, then pass the _emailRecipientString value, vSANIGNetworkEmailSubjectTextEmailSubject_1.Text value, ... to the flow. Then within your flow, send an email based on the passed parameter values from your app. Within your flow, you could consider add a "Get file content" action of SharePoint connector to get file content of the specific BoM file from your SP Library.

I have made a test on my side, please consider take a try with the following workaround:

Flow's configuration as below:

8.JPG

 

 

App's configuration:

9.JPG

 

More details about firing a flow from an app, please refer to the following article or video:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

https://www.youtube.com/watch?v=1wl9AtxWdkg

 

If you want to send multiple files using single one email sent from flow, please check the following thread:

https://powerusers.microsoft.com/t5/General-Power-Automate/Send-all-files-as-attachment-by-email-fro...

 

Please take a try with above alternative solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,233)