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 / Automating Email Respo...
Power Automate
Answered

Automating Email Responses and SharePoint Updates in Power Automate

(0) ShareShare
ReportReport
Posted on by 56

Hello Power Automate Community,

I’m currently working on building an automated workflow that responds to incoming emails and updates a SharePoint list based on the sender's email. The objective of the flow is to streamline communications by sending automatic replies and tracking interactions in a SharePoint list. Here’s an overview of my flow and the specific problem I’m encountering.

Flow Objective: The goal is to create a flow that:

Triggers when a new email arrives in the inbox. and for SharePoint using Get Items without any filter query as checking for all SharePoint list items.

Checks if the sender’s email is already recorded in a SharePoint list. Condition : length(body('Filter_array')) is greater than 0

If the sender is not found in the SharePoint list, sends an auto-reply and adds the sender's email to the list.

If the sender is found in the SharePoint list, checks the timestamp of the last interaction (recorded in the list). If more than 2 hours have passed since the last email, sends an auto-reply and updates the timestamp; otherwise, cancels the flow.

First Compose:  sort(body('Filter_array'),'LastSentTimestamp','desc')

Second Compose:  first(outputs('Compose'))

Condition: addHours(outputs('Compose_2')?['LastSentTimestamp'], 2) greater than utcNow()

Flow works fine for first time email. It sent email and also add records to SharePoint. But when new email arrives and records already exists in first sort it throw error

 
Please help me to resolved this issue. 
 
Categories:
I have the same question (0)
  • Personallearn Profile Picture
    56 on at
    Here I am also sharing run history of flow for existing email where flow failling. Please help me to resolved problem.
    Output of Filter Array: 

    [

      {

        "@odata.etag""\"1\"",

        "ItemInternalId""2",

        "ID"2,

        "Title""xyz@cont.com",

        "LastSentTimestamp""2024-11-29T05:48:59Z",

        "RecipientEmail""abc@cont.com",

        "Modified""2024-11-29T05:48:59Z",

        "Created""2024-11-29T05:48:59Z",

        "Author": {

          "@odata.type""#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

          "Claims""i:0#.f|membership|abc@cont.com",

          "DisplayName""ABC",

          "Email""abc@cont.com",

          "Picture""https://cont.sharepoint.com/sites/TestSite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=abc@cont.com",

          "Department""Applications",

          "JobTitle"null

        },

        "Author#Claims""i:0#.f|membership|abc@cont.com",

        "Editor": {

          "@odata.type""#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

          "Claims""i:0#.f|membership|abc@cont.com",

          "DisplayName""abc",

          "Email""abc@cont.com",

          "Picture""https://cont.sharepoint.com/sites/TestSite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=abc@cont.com",

          "Department""Applications",

          "JobTitle"null

        },

        "Editor#Claims""i:0#.f|membership|abc@cont.com",

        "{Identifier}""Lists%252fAutoReply%2blist%252f2_.000",

        "{IsFolder}"false,

        "{Thumbnail}": {

          "Large"null,

          "Medium"null,

          "Small"null

        },

        "{Link}""https://cont.sharepoint.com/sites/TestSite/_layouts/15/listform.aspx?PageType=4&ListId=5950d4a3%2Da615%2D4dda%2D8090%2D49eb8c2ec85e&ID=2&ContentTypeID=0x0100C08C41F723E6B040AF792ABE6AEB8D4D00FECBE6064B3A6F42890CBCCEFE5D5919",

        "{Name}""xyz@cont.com",

        "{FilenameWithExtension}""xyz@cont.com",

        "{Path}""Lists/AutoReply list/",

        "{FullPath}""Lists/AutoReply list/2_.000",

        "{HasAttachments}"false,

        "{VersionNumber}""1.0"

      }

    ]

     

  • Verified answer
    sandeep_angara Profile Picture
    430 Moderator on at
     
    The sort expression was wrong. The expression doesn’t accept a third parameter. For you to sort the array in descending order try the below expression:

    reverse(sort(body('Filter_array'),'LastSentTimestamp'))
     
    This will sort the array in ascending order and then reverses the order making it descending.
     
    If this helps, mark this as an answer. Else let me know how it goes.
     
    Thank you.

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!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 250 Super User 2026 Season 1

#2
Expiscornovus Profile Picture

Expiscornovus 222 Most Valuable Professional

#3
Haque Profile Picture

Haque 174

Last 30 days Overall leaderboard