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

parsing text from email to Sharepoint list without html to text connector

Hello, I am trying to parse text from an incoming email to a Sharepoint list like it is described in this tutorial (https://youtu.be/OrCs36S3w3w).

 

The difference is that the incoming email is already in text instead of HTML.

So I skipped the HTML to text connector and changed the expression for parsing the text like this:

 

original expression: first(skip(split(first(split(body('Html_to_text'),'Quantity')),': '),1))

adjusted: first(skip(split(first(split(triggerOutputs()?['body/body'],'Quantity')),': '),1))


Intention is to skip the not required "HTML to text" and get the text directly out of the email body.

But unfortunately I get the message that the printout is invalid.

Can anyone help me?

1 ACCEPTED SOLUTION

Accepted Solutions

Put the expression trim() around the full expression and it will remove the beginning and ending spaces.

 

trim(first(skip(split(triggerOutputs()?['body/body'],'Delivery Method:'),1)))

Or for your example

trim(first(skip(split(triggerOutputs()?['body/body'],'Nachrishtentext:'),1)))

View solution in original post

10 REPLIES 10

Can you show a screenshot of the incoming email how it looks in your inbox and also a screenshot of the input results of your flow that failed with the error? It would be helpful to see what you have.

 

I used the expression below and was able to get a Plain Text Email body to give me the response Chocolate Chip like in the video example.

first(skip(split(first(split(triggerOutputs()?['body/body'],'Quantity')),': '),1))

 

wskinnermctc_0-1675378605216.png

 

I would add a Trim() to the expression so that it removes any trailing or leading spaces or line breaks.

trim(first(skip(split(first(split(triggerOutputs()?['body/body'],'Quantity')),': '),1)))

 

(Note: When I was testing, right after I pressed Save and Test, I kept getting a message "Cannot read properties of undefined (reading 'properties')" and the flow would not test. However, I would just press the Save and Test again, and the flow would work. Seems like it is probably because I keep reusing a test flow for looking at questions on here.)

 

thank you very much. your expression is working 🙂 , but in my incoming email there is a dress to be parsed - using the the trim() it would only parse the first word of the text.

 

Thank you very much for support

Great! Glad to hear it is working.

If this post is resolved please mark the response as a solution so other people can easily reference it.

I am still struggling with the expression for the last part. I used your expression for the middle text, but the for the last one I am told that my expression is not guilty.

 

I used this one:

first(skip(split(triggerOutputs()?['body/body‘],’Beschreibung:’)),1))
 
In the original tutorial the expression is:
first(skip(split(body('Html_to_text'),'Delivery Method: '),1)) 
 
Would be perfect if you could fix the expression 🙂
 

I think it would help if you separated the individual expressions within the full expression for each final output you are trying to get.

The video link doesn't do a good job explaining what is going on within the expression, so it is difficult for to catch errors or adjust for any changes with your text or email.

 

To separate the first expression which gets the example Cookie Type there are 5 individual expressions that builds the full expression.

 

first(skip(split(first(split(triggerOutputs()?['body/body'],'Quantity')),': '),1))

 

The full Cookie Type expression says:

  1. Split the email body into separate parts/items whenever the term "Quantity" appears.

 

split(triggerOutputs()?['body/body'],'Quantity')

 

  • Next take the First output of the split body

 

first(split(triggerOutputs()?['body/body'],'Quantity'))

 

  • Next Split the first output of the split body whenever the text colon with a space ": " appears.

 

split(first(split(triggerOutputs()?['body/body'],'Quantity')),': ')

 

  • Next Skip the first item after splitting by the colon space ": "

 

skip(split(first(split(triggerOutputs()?['body/body'],'Quantity')),': '),1)

 

  • Next take the First output which will be the final result of Cookie Type

 

first(skip(split(first(split(triggerOutputs()?['body/body'],'Quantity')),': '),1))

 

 

To separate the second expression which gets the example Quantity there are also 5 individual expressions that builds the full expression.

 

first(skip(split(first(split(triggerOutputs()?['body/body'],'Delivery Method')),'Quantity: '),1))

 

 

The full Quantity type expression says:

  1. Split the email body into separate parts/items whenever the term "Delivery Method" appears.

 

split(triggerOutputs()?['body/body'],'Delivery Method')

 

  • Next take the First output of the split body

 

first(split(triggerOutputs()?['body/body'],'Delivery Method'))

 

  • Next Split the first output of the split body whenever the term Quantity colon with a space "Quantity: " appears.

 

split(first(split(triggerOutputs()?['body/body'],'Delivery Method')),'Quantity: ')

 

  • Next Skip the first item after splitting by the term Quantity colon space "Quantity: "

 

skip(split(first(split(triggerOutputs()?['body/body'],'Delivery Method')),'Quantity: '),1)

 

  • Next take the First output which will be the final result of Quantity

 

first(skip(split(first(split(triggerOutputs()?['body/body'],'Delivery Method')),'Quantity: '),1))

 

 

The final expression which gets the Delivery Method only has 3 individual expressions that builds the full expression. However, it will get all remaining text in the email if there is anything like a Signature Name in the email body.

 

first(skip(split(triggerOutputs()?['body/body'],'Delivery Method: '),1))

 

The full Delivery Method type expression says:

  1. Split the email body into separate parts/items whenever the term "Delivery Method: " appears.

 

split(triggerOutputs()?['body/body'],'Delivery Method: ')

 

  • Next Skip the first 1 output item of the previous split body

 

skip(split(triggerOutputs()?['body/body'],'Delivery Method: '),1)

 

  • Next take the First 1 output of the previous output

 

first(skip(split(triggerOutputs()?['body/body'],'Delivery Method: '),1))

 

 

I made an example flow that split the full expressions into each of it's individual expressions. The example flow uses the previous output to fill in the next expression value.

So Step A1 is the first part of the expression for Cookie Type, and then Step A2 uses the output of A1 to use it's individual expression. The final step A5 will be the same output as the full expression in A99 for cookie type.

The A99 step, B99 step, C99 step are all full expressions that would be similar to what you would use in your flow.

Full Example FlowFull Example Flow

I separated my example flow into different Scope for each full expression.

 

Scope A is for the Cookie Type

Example Flow Scope A Cookie TypeExample Flow Scope A Cookie Type

Scope B is for the Quantity

Example Flow Scope B QuantityExample Flow Scope B Quantity

Scope C is for the Delivery Method

Example Flow Scope C Delivery MethodExample Flow Scope C Delivery Method

 

The results of my example flow show how each individual part of the expression is using the outputs of the previous flow step.

 

I made an example Plain Text email for the trigger body.

The difference with my example email is that it has additional name signature information at the end. I included that to show that the final expression for Delivery Method will pull in additional text from the email body if it is not correctly changed for your situation.

 

Below is the example Email I used:

Example Email Plain TextExample Email Plain Text

 

Below is the results of Scope A to get Cookie Type:

  1. Split the email body into separate parts/items whenever the term "Quantity" appears.

 

[
  "Cookie Type: Chocolate Chip\r\n",
  ": 20\r\nDelivery Method: Pigeon\r\n\r\n\r\nMYName And Signature\r\nMyPhoneNumber 888-999-9999\r\n"
]

 

  • Next take the First output of the split body

 

Cookie Type: Chocolate Chip

 

  • Next Split the first output of the split body whenever the text colon with a space ": " appears.

 

[
  "Cookie Type",
  "Chocolate Chip\r\n"
]

 

  • Next Skip the first item after splitting by the colon space ": "

 

[
  "Chocolate Chip\r\n"
]

 

  • Next take the First output which will be the final result of Cookie Type

 

Chocolate Chip

 

Results Scope A Cookie TypeResults Scope A Cookie Type

 

Below is the results of Scope B to get Quantity:

  1. Split the email body into separate parts/items whenever the term "Delivery Method" appears.

 

[
  "Cookie Type: Chocolate Chip\r\nQuantity: 20\r\n",
  ": Pigeon\r\n\r\n\r\nMYName And Signature\r\nMyPhoneNumber 888-999-9999\r\n"
]

 

  • Next take the First output of the split body

 

Cookie Type: Chocolate Chip
Quantity: 20

 

  • Next Split the first output of the split body whenever the term Quantity colon with a space "Quantity: " appears.

 

[
  "Cookie Type: Chocolate Chip\r\n",
  "20\r\n"
]

 

  • Next Skip the first item after splitting by the term Quantity colon space "Quantity: "

 

[
  "20\r\n"
]

 

  • Next take the First output which will be the final result of Quantity

 

20

 

Full Scope B results

Scope B ResultsScope B Results

 

Below is the results of Scope C to get Delivery Method

Delivery Method type expression says:

  1. Split the email body into separate parts/items whenever the term "Delivery Method: " appears.

 

[
  "Cookie Type: Chocolate Chip\r\nQuantity: 20\r\n",
  "Pigeon\r\n\r\n\r\nMYName And Signature\r\nMyPhoneNumber 888-999-9999\r\n"
]

 

  • Next Skip the first 1 output item of the previous split body

 

[
  "Pigeon\r\n\r\n\r\nMYName And Signature\r\nMyPhoneNumber 888-999-9999\r\n"
]

 

  • Next take the First 1 output of the previous output

 

Pigeon


MYName And Signature
MyPhoneNumber 888-999-9999

 

Results Scope C Delivery MethodResults Scope C Delivery Method

I hope these examples help you create an expression to get the information you need. It is probably best if you understand the individual expressions that are building the full expression so that you can adjust or change things to accommodate your individual situation.

 

Cookie Type Full Expression:

 

first(skip(split(first(split(triggerOutputs()?['body/body'],'Quantity')),': '),1))

 

Quantity Full Expression:

 

first(skip(split(first(split(triggerOutputs()?['body/body'],'Delivery Method')),'Quantity: '),1))

 

Delivery Method Full Expression:

 

first(skip(split(triggerOutputs()?['body/body'],'Delivery Method: '),1))

 

 

Let me know if this works for you,

thank you very much for your great support. Sadly the expression doesn't work so far - the expression is providing no result. I added a screenshot of the incoming email and the expression of your reply adjusted with the entry of the incoming mail.

 

first(skip(split(triggerOutputs()?['body/body'],'Nachrichtentext: '),1))

 

the expression should provide the result: test test test --> but the result is: 0

 

 

Thank you for the photo of the email format. That made a difference. If you ask for help again on the forum it is beneficial to include your specific information for your flow. Especially screenshots.

 

The space at the end of 'Delivery Method: ' is what is causing the problem. The split is looking for a space to be after the colon: so when it doesn't find a space it doesn't do the split.

 

Your email doesn't have a space after your word 'Nachrichtentext: ' like the split expression is searching for.

Your email has a line break which is different than a space. So basically remove the space to make it 'Nachrichtentext:' and you will get the remaining text.

 

first(skip(split(triggerOutputs()?['body/body'],'Delivery Method:'),1))

Or using your example

first(skip(split(triggerOutputs()?['body/body'],'Nachrishtentext:'),1))

 

I tested with my flow and it worked. It should work for you as well.

thank you very much again. It works almost perfect the only minor error is that the parsed text does not start with the first letter. the is space or line break before. first picture is the incoming email and the second is the result in the form

Put the expression trim() around the full expression and it will remove the beginning and ending spaces.

 

trim(first(skip(split(triggerOutputs()?['body/body'],'Delivery Method:'),1)))

Or for your example

trim(first(skip(split(triggerOutputs()?['body/body'],'Nachrishtentext:'),1)))

Thank you very much...you are really awesome 😄

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 (883)