Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

Help with extracting information from body of email

Posted on 27 Nov 2024 16:14:43 by
Hi all, I'm having some trouble with a flow and hoping to get some input. 
What I want to achieve is fairly simple. When a certain email arrives, it saves the whole email into a specific SharePoint folder. But what I want to do, is with the naming of the file, I want to extract some information from the body of the email and save this in the file name. It just doesn't seem to be working. So far my flow looks like this: 
 
1. When a new email arrives - recipient in there as well as a filter by the word 'Confirmation' in the subject line
2. Condition action - filter the work Confirmation in the subject - if yes, goes to step 3
3. This is where I run into trouble because I tried just saving the file, but in order to name the file correctly I have to extract the data I need from the email body. I've followed some instructions and used a HTML to text action which does what it says, but when I do a compose action after this to get the information it's failing. 
4. So this step is 'Compose' to extract the first peice of information which is the booking reference number. The second compose is the 'Title' thats in the body. 
 
I'm getting the following error: 
Unable to process template language expressions in action 'Compose_-_reference' inputs at line '0' and column '0': 'The template language function 'indexOf' expects two parameters: the string as the first parameter, the value to find the index of as the second parameter. The function was invoked with '3' parameter(s). Please see https://aka.ms/logicexpressions#indexof for usage details.'.
 
Below is the outputs from the HTML to text action: (i've replaced some confidential information with ***'s 
{
    "statusCode": 200,
    "headers": {
        "Cache-Control": "no-store, no-cache",
        "Pragma": "no-cache",
        "Transfer-Encoding": "chunked",
        "Vary": "Accept-Encoding",
        "Set-Cookie": "ARRAffinity=c85838fcf7ee5278cd880b7886ac6709900e8967f551e575ce4342d3d993c719;Path=/;HttpOnly;Secure;Domain=conversionservice-eus.******-eus-002.p.azurewebsites.net,ARRAffinitySameSite=c85838fcf7ee5278cd880b7886ac6709900e8967f551e575ce4342d3d993c719;Path=/;HttpOnly;SameSite=None;Secure;Domain=conversionservice-eus.******-eus-002.p.azurewebsites.net",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
        "x-ms-request-id": "49621741-bc4c-46a5-a682-6764917e759d",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "DENY",
        "x-ms-environment-id": "default-568a5434-7d3f-4714-b824-fe722e2748c0",
        "x-ms-tenant-id": "568a5434-7d3f-4714-b824-fe722e2748c0",
        "x-ms-dlp-re": "-|-|-",
        "x-ms-dlp-gu": "-|-",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "false",
        "x-ms-apihub-obo": "false",
        "Date": "Wed, 27 Nov 2024 15:57:11 GMT",
        "Content-Type": "text/html; charset=utf-8",
        "Content-Length": "2336",
        "Expires": "-1"
    },
    "body": "********* Meeting Room Booking System (Do Not Reply)\n\nBooking Details\n\n \n\nBooking Reference:\n\n1137009 [https://mqb.*******-app.com.**/dwsapps-v2/ghw?meetingKey=1137009]\n\nTitle:\n\n********* | *** meeting\n\nStatus:\n\nBooked\n\nRoom:\n\n***\n\nDate:\n\n15/01/2025\n\nTime:\n\n11:00-12:00\n\nBooked for:\n\n******, ******\n\nBooked by:\n\n******, Stephanie\n\nType:\n\nExternal-Room Only\n\nAttendees:\n\n5\n\nLayout:\n\n*Standard*\n\nState:\n\nConfirmed-External\n\nCost Code:\n\n****************\n\nSite:\n\nLONDON - ** ********** Street\n\n \n\nService Item\n\nTime\n\nQuantity\n\nCost\n\nNotes\n\nApproval Status\n\nWater Complimentary\n\n11:00\n\n5\n\n0.00\n\nPre-approved\n\n 
}
 
Basically, I need to extract the booking reference number 1137009 and the meeting title (in stars). If I can extract them as separate bits of data, I can then use them as part of the title for my saved file. Whats the best way to tackle this? I've used Chat GPT and I'm just going around in circles. Thanks! 
Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,137

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,813

Leaderboard

Featured topics