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

Send Emails with Attachments based on excel sheet and directory of attachments both on onedrive

I have to send emails to a number of different people with a specific attachment for that person. I created an Excel spreadsheet with the data for the email and uploaded it to Onedrive for Business. I also created a folder on Onedrive for Business with each of the attachments in PDF format. I am trying to automate this Power Automate. I have tried many different flows but always run into issues. Can anyone help. 

Screen Shot 2021-07-10 at 4.45.31 PM.png

Screen Shot 2021-07-10 at 4.46.14 PM.png

Screen Shot 2021-07-10 at 4.46.48 PM.png

 

Error: 

Screen Shot 2021-07-10 at 4.56.05 PM.png

 

 

 

 

 

 

 

2308NewvilleFirst United  111 Big Spring Ave.ehb47@comcast.netStatements1.pdf
7314Camp HillCamp Hill  101 N. 23rd St.ehb47@comcast.netStatements2.pdf
7315CarlisleFirst  2A N. Hanover St.ehb47@comcast.netStatements3.pdf
7316CarlisleSecond  528 Garland Driveehb47@comcast.netStatements4.pdf
7317CarlisleDickinson  12 Church Rd.ehb47@comcast.netStatements5.pdf
7318ChambersburgCentral  40 Lincoln Way Westehb47@comcast.netStatements6.pdf
7319ChambersburgFalling Spring  221 N. Main St.ehb47@comcast.netStatements7.pdf
7321DillsburgMonaghan  1185 Gettysburg Pikeehb47@comcast.netStatements8.pdf
7323DuncannonDuncannon  3 N. High St.ehb47@comcast.netStatements9.pdf
7325GettysburgGettysburg  208 Baltimore St.ehb47@comcast.netStatements10.pdf
7326GettysburgGreat Conewago  174 Red Bridge Rd.ehb47@comcast.netStatements11.pdf
7327GettysburgLower Marsh Creek  1865 Knoxlyn Rd.ehb47@comcast.netStatements12.pdf
7328GreencastleGreencastle  57 W. Baltimore St.ehb47@comcast.netStatements13.pdf
7330HarrisburgCapital  1401 Cumberland St.ehb47@comcast.netStatements14.pdf
7333HarrisburgMarket Square  20 S. Second St.ehb47@comcast.netStatements15.pdf
7338HersheyDerry  248 E. Derry Rd.ehb47@comcast.netStatements16.pdf
7339LebanonChrist  1300 Maple St.ehb47@comcast.netStatements17.pdf
7340LebanonSt. Andrews  600 S. 12th St.ehb47@comcast.netStatements18.pdf
7341LoysvilleCentre  3912 Freeman Hollow Rd.ehb47@comcast.netStatements19.pdf
7342McConnellsburgMcConnellsburg  116 S. Second St.ehb47@comcast.netStatements20.pdf
7343MechanicsburgMechanicsburg  300 E. Simpson St.ehb47@comcast.netStatements21.pdf
7344MechanicsburgSilver Spring  444 Silver Spring Rd.ehb47@comcast.netStatements22.pdf
7345MercersburgUpper West Conecocheague 34 W. Seminary St.ehb47@comcast.netStatements23.pdf
7347MiddletownPresbyterian Congregation of MiddletownUnion and Water Sts.ehb47@comcast.netStatements24.pdf
7351NewvilleBig Spring  25 S. Corporation St.ehb47@comcast.netStatements25.pdf
7355ShippensburgMiddle Spring  125 Middle Spring Rd.ehb47@comcast.netStatements26.pdf
7357WaynesboroWaynesboro  105 E. Main St.ehb47@comcast.netStatements27.pdf
7359MillerstownPerry Valley  301 Old Ferry Rd.ehb47@comcast.netStatements28.pdf
7362Camp HillChrist  421 Deerfield Rd.ehb47@comcast.netStatements29.pdf
7567MifflinLower Tuscarora  54 Church Rd.ehb47@comcast.netStatements30.pdf
7593East WaterfordEast Waterford  POB 174ehb47@comcast.netStatements31.pdf
7609McAlistervilleLost Creek  Box 91ehb47@comcast.netStatements32.pdf
7611MifflintownWestminister  208 Lemon St.ehb47@comcast.netStatements33.pdf
7635Wells TanneryWells Valley  POB 27ehb47@comcast.netStatements34.pdf
8997MifflinMcCoysville  2562 McCoysville Rd.ehb47@comcast.netStatements35.pdf
9168DauphinHope  931 Red Hill Rd.ehb47@comcast.netStatements36.pdf
10164HarrisburgPine Street  310 N. Third St.ehb47@comcast.netStatements37.pdf
10359HarrisburgPaxton  3500 Sharon St.ehb47@comcast.netStatements38.pdf
11019Camp HillHarrisburg Korean  1127 Slate Hill Rd.ehb47@comcast.netStatements39.pdf
11159MechanicsburgSt. James  1425 Orr's Bridge Rd.ehb47@comcast.netStatements40.pdf
11436NewportHighland  11 Church Rd.ehb47@comcast.netStatements41.pdf
15128HarrisburgFaith Immanuel  1801 Colonial Rd.ehb47@comcast.netStatements42.pdf
23167Hancock, MDMt. Olivet  POB 327ehb47@comcast.netStatements43.pdf
23233WarfordsburgWarfordsburg  12941 Buck Valley Rd.ehb47@comcast.netStatements44.pdf

 

23 REPLIES 23

Sorry All, I now see I forgot to include the "File Content" variable in Send Email V2. But once added I get this error...

 

ExpressionEvaluationFailed. The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@{outputs('List_rows_present_in_a_table')?['body/value']}@{outputs('Get_file_content')?['body']}' is of type 'String'. The result must be a valid array.
 
 

Hi There! Can you show a screenshot of the final flow is looking now after the final change you did to include the "File Content" variable in Send Email V2?

The new error seems to suggest that you may have something else in the "apply to each" action apart from the "value" input.

mgrachii_0-1625972388552.png

 

Here is the error and the flow

 

Screen Shot 2021-07-11 at 6.19.53 PM.pngScreen Shot 2021-07-11 at 6.21.55 PM.png

Thanks!

 

Try removing the "file content" variable from the "apply to each" card. You should have "value" green card only

 

Let me know if that worked!

 

mgrachii_0-1626042534504.png

 

Now I get a null content error

 

Screen Shot 2021-07-11 at 6.35.38 PM.png

Do you still have "File content" at the bottom of the card?

#1 should be gone

#2 should stay

mgrachii_0-1626043340141.png

 

Yes...

Screen Shot 2021-07-11 at 6.48.08 PM.png

Can you try removing #2 and adding it back by selecting from the "dynamic content" area?

 

If that doesn't work , can you hover over "file content x" to see the formula that is generating behind the scenes?

Remove #2 and added it back...still did not work. Here is the formula generated

 

IMG_9758.jpeg

 

Very strange.

 

When you excecute the flow, what do you see in the output of the "Get file content" card? do you see a link to open the output? when you click in "download" should open and show you a lot of text with a "body" attribute in the 4rth line. can you check if you see this?

mgrachii_0-1626045964010.png

mgrachii_1-1626045997078.png

 

 

Something that I would do is removing the cards and adding them back

I believe I should be using "Get File Metadata by Folder" and "Get File Content by Folder". But If I try to use those, it shows me the folder on onedrive "Statements" but when I click on it, nothing happens...it won't let me select it. 

As it is now I am only getting metadata and content for a specific file and not every one in the folder which corresponds to the attachments in the Excel spreadsheet.

did you try checking the "outputs" from the Get file content card? (see screenshot above) 

What do you get when you see the ouputs ?

Here is the output

 

{"statusCode":200,"headers":{"Pragma":"no-cache","x-ms-request-id":"2d1f7813-3cd6-3926-b21b-de5fcdbfd529","Strict-Transport-Security":"max-age=31536000; includeSubDomains","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY","Cache-Control":"no-store, no-cache","Set-Cookie":"ARRAffinity=fa9050a86380ecce883d8ff2e805dd22d58cc29332b6761a0fc08c7d82b3fa74;Path=/;HttpOnly;Secure;Domain=office365-wus.azconn-wus-01.p.azurewebsites.net,ARRAffinitySameSite=fa9050a86380ecce883d8ff2e805dd22d58cc29332b6761a0fc08c7d82b3fa74;Path=/;HttpOnly;SameSite=None;Secure;Domain=office365-wus.azconn-wus-01.p.azurewebsites.net","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"false","Date":"Sun, 11 Jul 2021 23:40:51 GMT","Content-Length":"0","Expires":"-1"}}

 

I see. Seems like the OneDrive is not returning the file content. as you can see in the image previously sent and also below, when I replicate what you are doing I get a "body" attribute in the response. 

 

the response you shared doesn't include that. Can you make sure that the file and folder both exist , you can also try to remove the card and add it back to the flow, then add it again in the "send email" card.

 

can you show what you have in the "get file content" card? is it still the same text as you have in the initial post ?

 

{"statusCode":200,"headers":{"Pragma":"no-cache","x-ms-request-id":"71fe9f02-c92a-4568-a289-e9ebb4cff0ec","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"false","Accept-Ranges":"bytes","Cache-Control":"no-cache","Date":"Sun, 11 Jul 2021 23:24:45 GMT","ETag":"\"{2EE55A98-2CCC-4476-8075-5521F6381CDC},3\"","Location":"https://unitedstates-002.azure-apim.net/apim/onedriveforbusiness/shared-onedriveforbu-3759cb5a-6ee4-4be9-aefd-c3f5-6b6b22e8/datasets/default/files/b%2521cMm6r297B0mxTVN63MXKFXGxXkTOcOBIu-RSOFYp9KmtW-Nf5WFdQZ3usnYP51K_.01O55YGGUYLLSS5TBMOZCIA5KVEH3DQHG4/content?inferContentType=true","X-AspNet-Version":"4.0.30319","X-Powered-By":"ASP.NET","Content-Length":"1286581","Content-Disposition":"attachment; filename=\"merged-docs.pdf\"","Content-Type":"application/pdf","Expires":"-1"},"body":{"$content-type":"application/pdf","$content":"JVBERi0xLjQKJdP0zOEKMSAwIG9iago8PAovQ3JlYXRpb25EYXRlKEQ6MjAyMTA1MzEwMDQwMDkrMDAnMDAnKQovQ3JlYXRvcihQREZzaGFycCAxLjUwLjUxNDcgXCh3d3cucGRmc2hhcnAuY29tXCkpCi9Qcm9kdWNlcihQREZzaGFycCAxLjUwLjUxNDcgXCh3d3cucGRmc2hhcnAuY29tXCkpCj4+CmVuZG9ia

 

Ok...I deleted Apply to each and Send Email. I then checked to make sure folders and files on OneDrive were there and were connected. They were. I ran the flow and here is the input and output.

 

Input...This is very large for content, so I only copied a bit of it, but it shows the input is getting everything we need.

{"host":{"apiId":"subscriptions/9f3a0e5f-8058-487f-9d45-d3ff51164c54/providers/Microsoft.Web/locations/westus/runtimes/unitedstates-002/apis/office365","connectionReferenceName":"shared_office365","operationId":"SendEmailV2"},"parameters":{"emailMessage/To":"ehb47@comcast.net","emailMessage/Subject":"2nd Qtr Statement","emailMessage/Body":"<p>Dear Partners in Ministry,<br>\n<br>\nTest...Test</p>","emailMessage/From":"Treasurer@carlislepby.org","emailMessage/Attachments":[{"Name":"Statements1.pdf","ContentBytes":{"$content-type":"application/pdf","$content":"JVBERi0xLjMNJeLjz9MNCjEgMCB

 

 

Output  however is the same as before...

 

{"statusCode":200,"headers":{"Pragma":"no-cache","x-ms-request-id":"50e0a813-ed77-06f2-9270-234037f96c1d","Strict-Transport-Security":"max-age=31536000; includeSubDomains","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY","Cache-Control":"no-store, no-cache","Set-Cookie":"ARRAffinity=e198afec6581a1603d516688b9e05d55e216a7a6a28fad970baf7d024a095305;Path=/;HttpOnly;Secure;Domain=office365-wus.azconn-wus-01.p.azurewebsites.net,ARRAffinitySameSite=e198afec6581a1603d516688b9e05d55e216a7a6a28fad970baf7d024a095305;Path=/;HttpOnly;SameSite=None;Secure;Domain=office365-wus.azconn-wus-01.p.azurewebsites.net","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Date":"Mon, 12 Jul 2021 00:10:26 GMT","Content-Length":"0","Expires":"-1"}}

 

did you get the error again?

Yes...

Duration
00:00:36
Error
Action 'Send_an_email_(V2)' failed
Error Details
 
Parameter 'To' cannot be null or empty.
clientRequestId: bd555407-eea5-4334-ad12-c727e7a04567

That is an error a bit different.

Now the issue is that the "To" field is empty, do you have it populated?

 

Per the output you sent previously now it seems that the email now contains attachments, if you can share a screenshot to show how the "TO" field looks now

mgrachii_0-1626050916918.png

 

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!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

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   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

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.    

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 (1,435)