cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
d3ell
Helper V
Helper V

Send attachments on a sharepoint list via outlook connector

Hi All,

 

I have a form on powerapps and within the form i have an attachments datacard where i can upload attachments to the sharepoint list item.  these currently save correctly and stay in the correct items, however i'd like to add the attachments - all image files. to the email when i email the report out using the outlook connector. 

 

I have watched@Shanescows video ( https://www.youtube.com/watch?v=V3feURQfY3M ) on how to send multiple attachments and i have tried recreating this by using the OnAddFile function of the attachments box to create a collection and then try and send the collection so the OnAddFile formula is set to: 

Collect(Attachmentfiles,({Name: "Picture.jpg",ContentBytes:attachmentBox.Attachments, '@odata.type':""}))

and then the send email button is set to:

Office365.SendEmail("email@email.com", "has updated customer care works to plot ", "Job Referance has been updated, please log on to the portal to see updates,  ",{Attachments:Attachmentfiles})

I have tried this several ways, without the name column etc etc.

 

When i open the collection it appears to add the ContentBytes column twice and this fills with a table rather than individual items.

 

Am i going about this the correct way or is there a simple way to add the sharepoint list attachments to the email function?

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @d3ell ,

Based on the formula that you provided, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the OnAddFile property of the Attachments control to following:

 

ClearCollect(
Attachmentfiles,
ForAll(
RenameColumns(DataCardValue17.Attachments,"Name","Name1","Value","Value1"), /* <-- DataCardValue17 represents the Attachments control within my Edit form */
{Name: Name1, ContentBytes:Value1, '@odata.type': ""}
)
)

On your side, you should type:

 

 

ClearCollect(
             Attachmentfiles, 
             ForAll(
                     RenameColumns(attachmentBox.Attachments,"Name","Name1","Value","Value1"), 
                     {Name: Name1, ContentBytes: Value1, '@odata.type': ""}
             )
)

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

Office365.SendEmail(
"email@email.com",
"has updated customer care works to plot ",
"Job Referance has been updated, please log on to the portal to see updates, ",
{Attachments: Attachmentfiles}
)

But there is a limit with above solution, it could only send single one attachment file successfully once time. If you send multiple attachments files once time, the following error would show up:4.JPG

So I afraid that there is no way to send multiple attachments via Outlook connector within PowerApps currently.

 

As an alternative solution, I think Microsoft Flow could achieve your needs. You could create a flow on your side to monitor if a new item has been added into your SP list, if yes, fire a flow to send an email to a specific user with the attached files of the new added item as the email attachments.

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

 

6.JPG

 

7.JPG

Within the "Append to array variable" action, Value field set to following formula:

{
  "Name": @{items('Apply_to_each')?['DisplayName']},
  "ContentBytes": @{body('Get_attachment_content')?['$content']}
}

Please also check and see if the following video would help in your scenario:

https://www.youtube.com/watch?v=1s-3W3o-BYA

 

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

3 REPLIES 3
RandyHayes
Super User
Super User

@d3ell 

Take a look at this recent posting and see if it gives you some guidance.  If not, post back and we'll take it from there.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
v-xida-msft
Community Support
Community Support

Hi @d3ell ,

Based on the formula that you provided, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the OnAddFile property of the Attachments control to following:

 

ClearCollect(
Attachmentfiles,
ForAll(
RenameColumns(DataCardValue17.Attachments,"Name","Name1","Value","Value1"), /* <-- DataCardValue17 represents the Attachments control within my Edit form */
{Name: Name1, ContentBytes:Value1, '@odata.type': ""}
)
)

On your side, you should type:

 

 

ClearCollect(
             Attachmentfiles, 
             ForAll(
                     RenameColumns(attachmentBox.Attachments,"Name","Name1","Value","Value1"), 
                     {Name: Name1, ContentBytes: Value1, '@odata.type': ""}
             )
)

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

Office365.SendEmail(
"email@email.com",
"has updated customer care works to plot ",
"Job Referance has been updated, please log on to the portal to see updates, ",
{Attachments: Attachmentfiles}
)

But there is a limit with above solution, it could only send single one attachment file successfully once time. If you send multiple attachments files once time, the following error would show up:4.JPG

So I afraid that there is no way to send multiple attachments via Outlook connector within PowerApps currently.

 

As an alternative solution, I think Microsoft Flow could achieve your needs. You could create a flow on your side to monitor if a new item has been added into your SP list, if yes, fire a flow to send an email to a specific user with the attached files of the new added item as the email attachments.

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

 

6.JPG

 

7.JPG

Within the "Append to array variable" action, Value field set to following formula:

{
  "Name": @{items('Apply_to_each')?['DisplayName']},
  "ContentBytes": @{body('Get_attachment_content')?['$content']}
}

Please also check and see if the following video would help in your scenario:

https://www.youtube.com/watch?v=1s-3W3o-BYA

 

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.

@v-xida-msft  and @RandyHayes , 

I have created the Flow as you lined out (same steps are lined out in this blog post here). Just wanted to point out there is a small nuance now. 

YOU MUST click the little icon to change the Attachments fields from individual attachments to single array in order to use the Array Variable. 

image.png

image.png

image.png

Hope this helps!

Helpful resources

Top Solution Authors
Top Kudoed Authors
Users online (4,351)