I would love to be able to create a flow that can read the body of the email not just subject or attahcments names. Once it can read the body of the text and find key words, extract some of this content. Identify if its a date or string and create a calendar event, etc.
Solved! Go to Solution.
Hi @Anonymous,
Could you please share an example about your scenario?
Do you want to extract content from body of the email?
I assume that the details of your incoming email as below and you want to extract the Subject and End time content from Body of the email:I have made a test on my side and please take a try with the following workaround:
length(body('Html_to_text'))Add a "Compose 2" action, Inputs set to following formula:
add(indexOf(body('Html_to_text'),'End time'),10)
substring(body('Html_to_text'),outputs('Compose_2'),sub(outputs('Compose'),outputs('Compose_2')))Add a "Compose 4" action, Inputs set to following formula:
add(indexOf(body('Html_to_text'),'Subject'),9)Add a "Compose 5" action, Inputs set to following formula:
indexOf(body('Html_to_text'),'Start time')Add a "Compose 6" action, Inputs set to following formula:
substring(body('Html_to_text'),outputs('Compose_4'),sub(outputs('Compose_5'),outputs('Compose_4')))Add a "Create event (V1)" action, specify Calendar id, End time field set to output of "Compose 3" action, Start time field set to following formula:
utcNow()
Subject field set to output of "Compose 6" action.
Image reference:
The flow works successfully as below:
Best regards,
Kris
Hi @Anonymous,
Could you please share an example about your scenario?
Do you want to extract content from body of the email?
I assume that the details of your incoming email as below and you want to extract the Subject and End time content from Body of the email:I have made a test on my side and please take a try with the following workaround:
length(body('Html_to_text'))Add a "Compose 2" action, Inputs set to following formula:
add(indexOf(body('Html_to_text'),'End time'),10)
substring(body('Html_to_text'),outputs('Compose_2'),sub(outputs('Compose'),outputs('Compose_2')))Add a "Compose 4" action, Inputs set to following formula:
add(indexOf(body('Html_to_text'),'Subject'),9)Add a "Compose 5" action, Inputs set to following formula:
indexOf(body('Html_to_text'),'Start time')Add a "Compose 6" action, Inputs set to following formula:
substring(body('Html_to_text'),outputs('Compose_4'),sub(outputs('Compose_5'),outputs('Compose_4')))Add a "Create event (V1)" action, specify Calendar id, End time field set to output of "Compose 3" action, Start time field set to following formula:
utcNow()
Subject field set to output of "Compose 6" action.
Image reference:
The flow works successfully as below:
Best regards,
Kris
Kris,
My apologies for the late reply. I appreciate how creative the proposed solution is!
Thank you,
JP
Thanks for the detailed desciption, I tried to run it as described above but hot the following error;
The string was not recognized as a valid DateTime. There is an unknown word starting at index 10. clientRequestId: c7e6674c-5d20-458b-b65a-c692c6fef136
@v-xida-msft I know this is an old thread, but I found it while looking for a solution to the same problem.
The difference with mine is the data I'm looking for doesn't match a nice pattern that can be easily defined by say.. add(indexof ......), 10
For example the email has this data:
Enquiry from: Firstname Lastname Email: user@gmail.com Phone Number: 0299999876 First Night: Thursday, 17 January 2019
Number of Nights: 2
In each of these lines the number of characters to add to the indexof is different for each email.
How can I use a function to grab everything between the colon and the new line, trim it and place it in a variable?
I will also put this in a new thread.
Hi @Kris
Can you explain how to convert this example if the details repeated, how to loop through all iterations? I have a similar case, the number of items per email does very.
Outlook Calendar event details as below
Subject: FirstTestEvent
Start Time: 4/20/2019
End Time: 4/21/2019
Subject: SecondTestEvent
Start Time: 4/21/2019
End Time: 4/22/2019
Subject: ThirdTestEvent
Start Time: 4/22/2019
End Time: 4/23/2019
@HallieGUse the Split() expression to split on 'Subj' and then run the resulting array through a for-each.
Did you find any solutions to this? I'm trying to figure the same thing out. How to do this for data that might be a bit unstructured. For example, how do I grab whatever is between a "$" and ":" sign?
Hi! Did you ever find out how to do this? I'm facing the same issue.....
Anyone know how to do it as said in last posts here?
@Yanger @Brammers & @sxt173 Yes I have solved this. A long time ago I wrote a lengthy response in this thread with detailed steps and an explanation of how it all works. I spotted some typos, then did a couple of edits to fix them and it disappeared pending moderation. It has never re-appeared.
Probably enough time has passed to get over this immense frustration and I can re-do it. Maybe this weekend if I remember.
A somewhat abridged version of my original deleted reply:
Starting with this sample data:
Enquiry from: Firstname Lastname Email: user@gmail.com Phone Number: 0299999876 First Night: Thursday, 17 January 2019 Number of Nights: 2
To grab any of those fields in Flow you use a formula like this (example grabs the email)
trim( substring( body('Html_to_text'), add( indexOf( body('Html_to_text'), 'Email: ' ), 7), sub( indexOf( body('Html_to_text'), 'Phone Number: '), add( indexOf( body('Html_to_text'), 'Email: ' ), 7) ) ) )
The subsstring() function has 3 inputs, 1. the source string, 2. the start index, which is the number of characters into the string to start looking and 3. the length.
The objective therefore, is to derive 2. and 3. so we can grab the relevant text no matter how long is it.
So firstly we need to know how many characters into the source text to start. This is relatively easy:
add( indexOf( body('Html_to_text'), 'Email: ' ), 7)
The indexOf() function finds the number of characters into a text string that a string occurs. Here we are calculating the indexOf() the string "Email: " it doesn't matter where in the original message body this occurs, indexOf() will find it and return a number.
Now we don't actually want the string "Email: " in the output of this expression so we now add() a number to the output of indexOf() to get the number of characters into the message body the end of "Email: " occurs. We don't calculate this dynamically; it's 7, including the space.
So by using indexOf() to find the place in the source string where "Email: " exists, then adding that number of characters to it, we get the point we want to start reading the email address.
Next we have to calculate the length of the string, for the 3rd parameter of substring():
sub( indexOf( body('Html_to_text'), 'Phone Number: '), add( indexOf( body('Html_to_text'), 'Email: ' ), 7) )
To do this we use the sub() function to subtract the number we just calculated from the indexOf() the place we want to stop looking. Thus a lot (the second parameter of sub()) of the expression above is similar to the one before - calculating the number of characters into the source string that our relevant text starts.
The first parameter of sub() is the place where our relevant text ends - which in this case is the start of the string "Phone Number: ". We don't need to do anything complex with this because it's the start of the string we want the index of, not the end.
So we now have our 3 parameters for substring(), the source text, which is body('Html_to_text') in this example, the number of characters into that where we find the start of our substring and lastly length, which is calculated by subtracting the former from the number of characters into the source text where we want to stop looking.
Finally, in my example I've wrapped trim() around the whole thing to eliminate any trailing whitespace.
You could probably improve upon this by calculating the number of characters where your desired string starts in a compose action, then using that as dynamic content in the expression to simplify it a bit, instead of repeating the same formula twice in the one expression.
@WillPage I want to do exactly the same thing, I need to get an email address from the body of an email and send a new email to that address. My email account is Gmail. Where do I place the code you posted below? (totally new to flow). Obviously my first condition is "When a new email arrives" and I assume the next is where I paste your code but you don't mention what type of action to select. And I also assume my next action is to send a new email but what do I put in the "to" field there?
@pjmarcumStraight after your trigger, add an HTML to Text action and put the body of the email from the trigger in there. Next, add a Compose and put the expression there, using the output of the previous HTML to Text action in the expression.
LOL.... I'm sure this is great feedback but unfortunately way above my expertise. 🙂
Hi @v-xida-msft ,
My case is a little different and I want to extract the email address after the From: of a forwarded email. Does the number of Compose change and do I need to change the code for them?
@AnonymousSee my blog post on how to do this: https://willpagenz.wordpress.com/2020/08/21/extract-from-address-from-forwarded-email-in-power-automate-logic-apps/
Hello Team,
Any recommendations on trying to extract say a reference number that will start with CX but could be anywhere in the email body on any new email. there is no set template and can come through anytime.
Regards,
Andy
If the reference number is always the same number of characters then you would use substring like this. Assume it's a 8 character reference including the CX (and you want to keep the CX in the substring)
substring(body('HTML_to_Text'),indexOf(body('HTML_to_Text'),'CX'),8)
..where body('HTML_to_Text') is the output of your HTML to text conversion action.
A few pitfalls: This will always find the first instance of CX in the text. If you have many then it's more complicated finding the right one.
Thankfully there are few ordinary words with cx in them but there's a small chance of picking that up too.
Another method you could use is this:
Split(body('HTML_to_Text'),'CX') to create an array of strings that start at each instance of CX (without the actual CX bit at the front), with the first item being the start of the whole input..
Now if your ref numbers are always 8 characters including CX you add a Select action, click the little icon to change from key-value input to JSON input and do this in the expression editor concat('CX',substring(item(),0,6).
The resulting array will be a list of possible reference numbers. Not knowing what they look like I can't advise how to filter out invalid ones (the first one will almost certainly be invalid) but at this point you can do further processing to get rid on any bogus elements in the array and hone down to the valid one(s).
Kris,
I have a similar situation that I need help on. In my case, the fields of the form input are displayed in the email like this (with the relevant information I want to extract in the line or lines below the field header):
The problem I've encountered is that in some cases, the requestor can fill out more than one item per field and that adds lines to the email like this:
I’ve been able to create a flow that converts the HTML to text and then returns data by extracting data by line. The issue is that there are some conditional fields in the form and that adds lines to the email. There is also the ability to select multiple responses for certain fields and that also adds lines to the email. When that happens the result is that the extract is incorrect.
My thought is to search the field names and have Power Automate select all the text between names (terms), after I’ve converted the email body to text from HTML.
So my questions are; 1) Is that a sound approach and 2) what expressions should I use for that action?
Please let me know your thoughts. Thanks.
We are excited to kick off our new #TuesdayTIps series, "Back to Basics." This weekly series is our way of helping the amazing members of our community--both new members and seasoned veterans--learn and grow in how to best engage in the community! Each Tuesday, we will feature new areas of content that will help you best understand the community--from ranking and badges to profile avatars, from Super Users to blogging in the community. Our hope is that this information will help each of our community members grow in their experience with Power Platform, with the community, and with each other! This Week's Tips: Account Support: Changing Passwords, Changing Email Addresses or Usernames, "Need Admin Approval," Etc.Wondering how to get support for your community account? Check out the details on these common questions and more. Just follow the link below for articles that explain it all.Community Account Support - Power Platform Community (microsoft.com) All About GDPR: How It Affects Closing Your Community Account (And Why You Should Think Twice Before You Do)GDPR, the General Data Protection Regulation (GDPR), took effect May 25th 2018. A European privacy law, GDPR imposes new rules on companies and other organizations offering goods and services to people in the European Union (EU), or that collect and analyze data tied to EU residents. GDPR applies no matter where you are located, and it affects what happens when you decide to close your account. Read the details here:All About GDPR - Power Platform Community (microsoft.com) Getting to Know You: Setting Up Your Community Profile, Customizing Your Profile, and More.Your community profile helps other members of the community get to know you as you begin to engage and interact. Your profile is a mirror of your activity in the community. Find out how to set it up, change your avatar, adjust your time zone, and more. Click on the link below to find out how:Community Profile, Time Zone, Picture (Avatar) & D... - Power Platform Community (microsoft.com) That's it for this week. Tune in for more Tuesday Tips next Tuesday and join the community as we get "Back to Basics."
Are you attending the Microsoft Power Platform Conference 2023 in Las Vegas? If so, we invite you to join us for the MPPC's Got Power Talent Show! Our talent show is more than a show—it's a grand celebration of connection, inspiration, and shared journeys. Through stories, skills, and collective experiences, we come together to uplift, inspire, and revel in the magic of our community's diverse talents. This year, our talent event promises to be an unforgettable experience, echoing louder and brighter than anything you've seen before. We're casting a wider net with three captivating categories: Demo Technical Solutions: Show us your Power Platform innovations, be it apps, flows, chatbots, websites or dashboards... Storytelling: Share tales of your journey with Power Platform. Hidden Talents: Unveil your creative side—be it dancing, singing, rapping, poetry, or comedy. Let your talent shine! Got That Special Spark? A Story That Demands to Be Heard? Your moment is now! Sign up to Showcase Your Brilliance: https://aka.ms/MPPCGotPowerSignUp Deadline for submissions: Thursday, Sept 28th How It Works: Submit this form to sign up: https://aka.ms/MPPCGotPowerSignUp We'll contact you if you're selected. Get ready to be onstage! The Spotlight is Yours: Each participant has 3-5 minutes to shine, with insightful commentary from our panel of judges. We’re not just giving you a stage; we’re handing you the platform to make your mark. Be the Story We Tell: Your talents and narratives will not just entertain but inspire, serving as the bedrock for our community’s future stories and successes. Celebration, Surprises, and Connections: As the curtain falls, the excitement continues! Await surprise awards and seize the chance to mingle with industry experts, Microsoft Power Platform leaders, and community luminaries. It's not just a show; it's an opportunity to forge connections and celebrate shared successes. Event Details: Date and Time: Wed Oct 4th, 6:30-9:00PM Location: MPPC23 at the MGM Grand, Las Vegas, NV, USA
The Reading Dynamics 365 and Power Platform User Group is a community-driven initiative that started in September 2022. It has quickly earned recognition for its enthusiastic leadership and resilience in the face of challenges. With a focus on promoting learning and networking among professionals in the Dynamics 365 and Power Platform ecosystem, the group has grown steadily and gained a reputation for its commitment to its members! The group, which had its inaugural event in January 2023 at the Microsoft UK Headquarters in Reading, has since organized three successful gatherings, including a recent social lunch. They maintain a regular schedule of four events per year, each attended by an average of 20-25 enthusiastic participants who enjoy engaging talks and, of course, pizza. The Reading User Group's presence is primarily spread through LinkedIn and Meetup, with the support of the wider community. This thriving community is managed by a dedicated team consisting of Fraser Dear, Tim Leung, and Andrew Bibby, who serves as the main point of contact for the UK Dynamics 365 and Power Platform User Groups. Andrew Bibby, an active figure in the Dynamics 365 and Power Platform community, nominated this group due to his admiration for the Reading UK User Group's efforts. He emphasized their remarkable enthusiasm and success in running the group, noting that they navigated challenges such as finding venues with resilience and smiles on their faces. Despite being a relatively new group with 20-30 members, they have managed to achieve high attendance at their meetings. The group's journey began when Fraser Dear moved to the Reading area and realized the absence of a user group catering to professionals in the Dynamics 365 and Power Platform space. He reached out to Andrew, who provided valuable guidance and support, allowing the Reading User Group to officially join the UK Dynamics 365 and Power Platform User Groups community. One of the group's notable achievements was overcoming the challenge of finding a suitable venue. Initially, their "home" was the Microsoft UK HQ in Reading. However, due to office closures, they had to seek a new location with limited time. Fortunately, a connection with Stephanie Stacey from Microsoft led them to Reading College and its Institute of Technology. The college generously offered them event space and support, forging a mutually beneficial partnership where the group promotes the Institute and encourages its members to support the next generation of IT professionals. With the dedication of its leadership team, the Reading Dynamics 365 and Power Platform User Group is poised to continue growing and thriving! Their story exemplifies the power of community-driven initiatives and the positive impact they can have on professional development and networking in the tech industry. As they move forward with their upcoming events and collaborations with Reading College, the group is likely to remain a valuable resource for professionals in the Reading area and beyond.
As the sun sets on the #SummerofSolutions Challenge, it's time to reflect and celebrate! The journey we embarked upon together was not just about providing answers – it was about fostering a sense of community, encouraging collaboration, and unlocking the true potential of the Power Platform tools. From the initial announcement to the final week's push, the Summer of Solutions Challenge has been a whirlwind of engagement and growth. It was a call to action for every member of our Power Platform community, urging them to contribute their expertise, engage in discussions, and elevate collective knowledge across the community as part of the low-code revolution. Reflecting on the Impact As the challenge ends, it's essential to reflect on the impact it’s had across our Power Platform communities: Community Resilience: The challenge demonstrated the resilience of our community. Despite geographical distances and diverse backgrounds, we came together to contribute, learn, and collaborate. This resilience is the cornerstone of our collective strength.Diverse Expertise: The solutions shared during the challenge underscore the incredible expertise within our community. From intricate technical insights to creative problem-solving, our members showcased their diverse skill sets, enhancing our community's depth.Shared Learning: Solutions spurred shared learning. They provided opportunities for members to grasp new concepts, expand their horizons, and uncover the Power Platform tools' untapped potential. This learning ripple effect will continue to shape our growth. Empowerment: Solutions empowered community members. They validated their knowledge, boosted their confidence, and highlighted their contributions. Each solution shared was a step towards personal and communal empowerment. We are proud and thankful as we conclude the Summer of Solutions Challenge. The challenge showed the potential of teamwork, the benefit of knowledge-sharing, and the resilience of our Power Platform community. The solutions offered by each member are more than just answers; they are the expression of our shared commitment to innovation, growth, and progress! Drum roll, Please... And now, without further ado, it's time to announce the winners who have risen above the rest in the Summer of Solutions Challenge! These are the top community users and Super Users who have not only earned recognition but have become beacons of inspiration for us all. Power Apps Community: Community User Winner: @SpongYe Super User Winner: Pending Acceptance Power Automate Community: Community User Winner: @trice602 Super User Winner: @Expiscornovus Power Virtual Agents Community: Community User Winner: Pending AcceptanceSuper User: Pending Acceptance Power Pages Community: Community User Winner: @OOlashyn Super User Winner: @ChristianAbata We are also pleased to announced two additional tickets that we are awarding to the Overall Top Solution providers in the following communities: Power Apps: @LaurensM Power Automate: @ManishSolanki Thank you for making this challenge a resounding success. Your participation has reaffirmed the strength of our community and the boundless potential that lies within each of us. Let's keep the spirit of collaboration alive as we continue on this incredible journey in Power Platform together.Winners, we will see you in Vegas! Every other amazing solutions superstar, we will see you in the Community!Congratulations, everyone!
Ayonija Shatakshi, a seasoned senior consultant at Improving, Ohio, is a passionate advocate for M365, SharePoint, Power Platform, and Azure, recognizing how they synergize to deliver top-notch solutions. Recently, we asked Ayonija to share her journey as a user group leader, shedding light on her motivations and the benefits she's reaped from her community involvement. Ayonija embarked on her role as a user group leader in December 2022, driven by a desire to explore how the community leveraged various Power Platform components. When she couldn't find a suitable local group, she decided to create one herself! Speaking about the impact of the community on her professional and personal growth, Ayonija says, "It's fascinating to witness how everyone navigates the world of Power Platform, dealing with license constraints and keeping up with new features. There's so much to learn from their experiences.: Her favorite aspect of being a user group leader is the opportunity to network and engage in face-to-face discussions with fellow enthusiasts, fostering deeper connections within the community. Offering advice to budding user group leaders, Ayonija emphasized the importance of communication and consistency, two pillars that sustain any successful community initiative. When asked why she encourages others to become user group leaders, Ayonija said, "Being part of a user group is one of the best ways to connect with experienced professionals in the same field and glean knowledge from them. If there isn't a local group, consider starting one; you'll soon find like-minded individuals." Her highlight from the past year as a user group leader was witnessing consistent growth within the group, a testament to the thriving community she has nurtured. Advocating for user group participation, Ayonija stated, "It's the fastest route to learning from the community, gaining insights, and staying updated on industry trends." Check out her group: Cleveland Power Platform User Group
Hear from Corporate Vice President for Microsoft Business Applications & Platform, Charles Lamanna, as he looks ahead to the second annual Microsoft Power Platform Conference from October 3rd-5th 2023 at the MGM Grand in Las Vegas.Have you got your tickets yet? Register today at www.powerplatformconf.com
User | Count |
---|---|
62 | |
36 | |
32 | |
28 | |
25 |
User | Count |
---|---|
83 | |
77 | |
63 | |
57 | |
54 |