web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extracting date and ti...
Power Automate
Unanswered

Extracting date and time from an email subject and update a sharepoint list

(0) ShareShare
ReportReport
Posted on by 4

I have an email subject line that looks like this

 

**** OUTAGE - CAD MONTHLY Outage - Thursday 5th October - 0130 hrs to 0500 hrs *****

 

It has the stars at the start and end unfortunately.

 

I am looking to extract the Date with the start time and then the Date with end time, so it will allow me to update a sharepoint list with the subject line as the "Issue" and the "Disruption Start Date and Time" along with "Disruption End Date and Time".

 

Adding the subject line is easy but extracting the date is hurting my head.

Categories:
I have the same question (0)
  • UshaJyothiKasibhotla Profile Picture
    225 Moderator on at

    split the subject value as required write the function in compose 

  • Harmsolo Profile Picture
    4 on at

    I've been trying that but getting errorsimage.png

  • Jcook Profile Picture
    7,783 Most Valuable Professional on at

    Hello @Harmsolo 

    If you subject is is in the same format as what you provided

    **** OUTAGE - CAD MONTHLY Outage - Thursday 5th October - 0130 hrs to 0500 hrs *****

    Extracting the Issue

    You can use split() to divide the string at ’ - ’ and take the first part.

    split(triggerBody()?['subject'], ' - ')[0]

    This expression splits the subject line at ’ - ’ and takes the first part, which should be your issue.

     

    Extracting the Start Date and Time

    Since the date and time format seems consistent, you can use substring() along with indexOf() to extract the start date and time.

    substring(triggerBody()?['subject'], indexOf(triggerBody()?['subject'], ' - ')+3, 22)

    This expression finds the first ’ - ’ in the subject, then takes a substring starting three characters after that up to the length of the date and start time string.

     

    Extracting the End Time

    The end time can be extracted similarly, but you’ll need to find the ‘to’ part.

    substring(triggerBody()?['subject'], lastIndexOf(triggerBody()?['subject'], 'to ') + 3, 5)

    This extracts the end time part of the string.

     

    Remember, these expressions assume a consistent format in the email subject line. If the format varies significantly, you might need more complex logic or regular expressions to handle those cases.

    TEST TEST.

     

  • Harmsolo Profile Picture
    4 on at

    Thanks for all your help, I ended up building it a different way using an array.  Now I am trying to get to the event time to reflect correctly in my sharepoint list.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 791

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 535

Last 30 days Overall leaderboard