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
Solved! Go to Solution.
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:
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:
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,
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.
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:
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:
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,
@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.
Hope this helps!
User | Count |
---|---|
121 | |
88 | |
88 | |
75 | |
66 |
User | Count |
---|---|
216 | |
180 | |
138 | |
96 | |
82 |