cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Attach multiple SharePoint files to a single email message

I created a flow that grabs some files and zips them up, then emails me the zip file. That is working fine -- the right files are in the zip file, which is attached to the email. Then, I thought, why bother zipping them up -- just attach them. I figured I could just remove the zip step, and put the array variable in as the attachment, but it's sending me an email message with no files attached. Is there an additional step that I need? Here's my current flow...

 

Capture.JPGCapture2.JPG

 

I've read through several posts on here about attaching multiple files, and I've tried the different JSON in the append variable step, but the same result each time. I've been looking at this for five hours and I'm nearing the point of insanity. If it passes the files to be zipped, shouldn't it attach them? What am I missing?

 

Thank you so much to anyone who can help.

1 ACCEPTED SOLUTION

Accepted Solutions

@tcaruso 

 

Okay, I updated above that instead of clicking the dynamic content for "Name" it needs to be the "File name with extension".

 

As for the question about the other on the ContentBytes… When you click in the value box and have that box pop out to the side and you can either see "Dynamic content" or "Expression". This will be done in the "Expression" side. So you click it and then type. See below:

 

image.png

 

And then click OK

 

This is the section you will do format for different things also.

 

Let me know if this gets you there.

View solution in original post

18 REPLIES 18
ScottShearer
Most Valuable Professional
Most Valuable Professional

@tcaruso 

Do you see an error?  If so, can you post a screen shot of the error? How large are the files?

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

I don't get an error, and in fact, the Flow reports that it runs successfully. Is there a logging thing that I can turn on? I only know how to see that kind of thing in testing mode, but as I say, it's succeeding.

@tcaruso 

The best thing to do right now is to look at your last run.  Look at the output of each action, etc..  Does it look like the data and files that you expected to be there are actually there?  Doe your variable look like it has data?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
ScottShearer
Most Valuable Professional
Most Valuable Professional

@tcaruso 

I just noticed that I I believe you have the wrong value selected for file identifier in your get attachment content action (it's a bit confusing).  See my screen shot below:

WrongID.png

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

I'm not using a "get attachments", because I'm using files not list items. I tried that, but every "get attachments" option wants a list name.

I might need some assistance in doing so. Does the fact that the same flow previously sent the files correctly to the zipping action not indicate that those steps are working correctly?

 

I can see that it's stepping through the files...

 

Capture.JPG

 

I didn't include the file names in the screen shot so that I didn't have to anonymize it, but the file names are correct. When I hit the outputs download, I get this...

 

{"statusCode":200,"headers":{"Transfer-Encoding":"chunked","X-SharePointHealthScore":"1","X-MS-SPConnector":"1","X-SP-SERVERSTATE":"ReadOnly=0","DATASERVICEVERSION":"3.0","X-Download-Options":"noopen","SPClientServiceRequestDuration":"139","SPRequestGuid":"5a139384-6e52-4db5-89e4-27f6fda2d0cd","request-id":"5a139384-6e52-4db5-89e4-27f6fda2d0cd","MS-CV":"hJMTWlJutU2J5Cf2/aLQzQ.0","Strict-Transport-Security":"max-age=31536000","X-FRAME-OPTIONS":"SAMEORIGIN","MicrosoftSharePointTeamServices":"16.0.0.20015","X-Content-Type-Options":"nosniff","X-MS-InvokeApp":"1; RequireReadOnly","X-MSEdge-Ref":"Ref A: 7F390B1313E548EDAAC1EB158A30BB9D Ref B: BN3EDGE0707 Ref C: 2020-04-28T22:53:29Z","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Cache-Control":"max-age=0, private","Date":"Tue, 28 Apr 2020 22:53:29 GMT","P3P":"CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"","X-AspNet-Version":"4.0.30319","X-Powered-By":"ASP.NET","Content-Disposition":"attachment","Content-Type":"application/pdf","Expires":"Mon, 13 Apr 2020 22:53:29 GMT","Last-Modified":"Tue, 28 Apr 2020 22:53:29 GMT","Content-Length":"3349222"},"body":{"$content-type":"application/pdf","$content":"JVBE...Cg==}}

where the ellipses at the end represent roughly 1.8MM random characters.

 

Then the variable output looks like this...

 

{"name":"Files","value":{"fileName":"redactedpkg.pdf","fileContent":"JVBE...Cg==}}

 

So, if nothing else, it appears to be passing one file, which should be enough to at least attach that.

This is infuriating, because I already put together a whole reply regarding the outputs of the last run, and it doesn't seem to have posted. I'm not entirely sure how best to do this, but I'll repeat what I did a few minutes ago. (This goes right along with the day that I've had trying to get this to work.)

 

I can see that it's stepping through the three files:

 

Capture.JPG

 

The file names are right and there are truly three of them. They have a person's name in the file name, so I'm not including them, so that I don't have to black that out on each of them.

 

Next, we have...

 

Capture2.JPG

 

However, it does look different on the second and third files.  I don't know how to read this, but here's the second. I've removed the millions of random characters after "$content" and just replaced with ellipses...

 

{"statusCode":200,"headers":{"Transfer-Encoding":"chunked","X-SharePointHealthScore":"1","X-MS-SPConnector":"1","X-SP-SERVERSTATE":"ReadOnly=0","DATASERVICEVERSION":"3.0","X-Download-Options":"noopen","SPClientServiceRequestDuration":"78","SPRequestGuid":"b5ef020d-5db4-41c7-98d9-5ba4425ceb58","request-id":"b5ef020d-5db4-41c7-98d9-5ba4425ceb58","MS-CV":"DQLvtbRdx0GY2VukQlzrWA.0","Strict-Transport-Security":"max-age=31536000","X-FRAME-OPTIONS":"SAMEORIGIN","MicrosoftSharePointTeamServices":"16.0.0.20015","X-Content-Type-Options":"nosniff","X-MS-InvokeApp":"1; RequireReadOnly","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Cache-Control":"max-age=0, private","Date":"Tue, 28 Apr 2020 22:53:27 GMT","P3P":"CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"","X-AspNet-Version":"4.0.30319","X-Powered-By":"ASP.NET","Content-Disposition":"attachment","Content-Type":"application/pdf","Expires":"Mon, 13 Apr 2020 22:53:28 GMT","Last-Modified":"Tue, 28 Apr 2020 22:53:28 GMT","Content-Length":"589673"},"body":{"$content-type":"application/pdf","$content":"JVB...DQo="}}

 

And, then, the variable inputs:

 

{"name":"Files","value":{"fileName":"blah.pdf","fileContent":"JVB...DQo="}}

rebeccas
Community Champion
Community Champion

I use the attachments more than get file but I think you need to change in your Append to array variable where it says "fileContent" to "contentBytes"

 

I usually put in a compose, click on the fields and see what it says when I hover of it and then delete the compose after I have it to figure out which it is. 

Thank you for the suggestion. I tried replacing "fileContent" with "contentBytes" (are those case-sensitive?), but got the same result -- an email message with no file attachment. Was there a corresponding change that I was supposed to make on the other side of the colon?

 

If you have a minute to explain the compose thing in a little more detail, I'd appreciate it. I tried putting that in there after the append, but not really sure what to look for.

@tcaruso 

Please post a screen shot of your entire Flow and I'll assist.  The more detail the better.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Well, now I'm going backwards. I did nothing but make the change recommended by the other person, and now it won't send the email at all.  I'm getting this error message:

 

The request failed. Error code: 'ErrorRequiredPropertyMissing'. Error Message: 'Required property is missing.'.

 

I tried redoing the JSON from scratch, back to my original (posted above), but same thing. If I remove the variable from the attachments field, it sends fine without an attachment. Put the attachment back in (the array variable), and it gives this error message. Same exact flow as yesterday, completely different result. 

 

I should probably just quit. I literally couldn't be more frustrated

 

Okay, after a few deep breaths, here's my entire flow...

 

Capture.JPGCapture2.JPGCapture3.JPG

Anytime you make a change above it is a good rule of thumb to delete it below and put it back. So if you changed your Append to array variable on the email you need to just delete it off your email attachments and then you can put it right back on there. I can't give a solid answer as to why but it will need to be done to work...regardless. 

 

As for the compose part. I just use that has a helping tool when I am unsure what exactly I should be referring to. So I just put a compose in above the append to array variable and then I clicked on the File content (from dynamic content) for the Get file content and hover over it to see how it is described. I use this a lot but I do it more often for SharePoint list attachments so that is more what I am familiar with. 

Any chance there's anyone out there who can help? Would certainly appreciate it.

@tcaruso 

 

Okay...I did a test to make sure it works on my end and figured out what your issue is. 

 

The first three things (For a selected file, Get files, and Initialize variable)  are good and the Apply to each with the Get file content is good. 

 

The Append to array variable is what needs to be changed.

 

You need:

{

"Name": <Click "File name with extension" from dynamic content> ,

"ContentBytes": <In expression part type in: body('Get_file_content')['$content']

}

 

See image below:

 

image.png

 

After you make that change go down to the email attachments part and then delete the variable you have there and put it right back. 

 

Then it should work. Make sure you go test by triggering the flow from the folder...not by doing the selection for "Using data from previous runs"...this is one that doesn't work well for this trigger.

 

Let me know if you still have trouble, I saved my test one for a bit to look back at.

Thank you so much. I do see that you said to wait a minute, but in case this part stays in the final solution: <In expression part type in: body('Get_file_content')['$content']

 

I don't understand the first part of that: "<In expression part type in:" This is a little beyond my comprehension. If you don't mind, I might need a little more detail on that.

 

Again, I really thank you for taking the time.

@tcaruso 

 

Okay, I updated above that instead of clicking the dynamic content for "Name" it needs to be the "File name with extension".

 

As for the question about the other on the ContentBytes… When you click in the value box and have that box pop out to the side and you can either see "Dynamic content" or "Expression". This will be done in the "Expression" side. So you click it and then type. See below:

 

image.png

 

And then click OK

 

This is the section you will do format for different things also.

 

Let me know if this gets you there.

You rock! Thanks so much. That worked like a charm. Some day I'll figure out why the expressions change based on your trigger.

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Summer of Solutions | Week 3 Results | Win free tickets to the Power Platform Conference

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22  

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (4,952)