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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

Move Emails if red

(0) ShareShare
ReportReport
Posted on by 2
Hello Community,
 
I'm trying to build a Flow that runs three times a day and checks the first 10 emails in my inbox to see if they have been read. If they are read, I want the Flow to move them to a specific folder. However, I'm running into an issue where the condition in my Flow never evaluates to TRUE, even for read emails.
My Flow setup includes the following actions:

1. Scheduled trigger (runs three times a day)
2. Get Emails (V3) – Retrieves the first 10 emails.
3. For Each – Iterates over each email.
4. Condition – Checks if `isRead` is `TRUE`.
5. Move Email – Moves the email to a specific folder if the condition is met.
 
Here are the relevant JSON code snippets:
 
1. Scheduled trigger:
{
  "type": "Recurrence",
  "recurrence": {
    "frequency": "Day",
    "interval": 1,
    "timeZone": "W. Europe Standard Time",
    "startTime": "2024-10-30T08:00:00.000Z",
    "schedule": {
      "hours": [
        "9",
        "16",
        "20"
      ]
    }
  },
  "metadata": {
    "operationMetadataId": "ee2ee2ec-6cb4-48a8-bad2-53c4a4e1a7a2"
  }
}
 
2. Get Emails (V3):
{
  "type": "OpenApiConnection",
  "inputs": {
    "parameters": {
      "folderPath": "Id::AAMkAGZhMWNkY2E5LTg5ZDEtNGRkOC04MWI0LTQwYzhjYzFmYzY1MQAuAAAAAADRvOHmFy9mQpguzszks1X6AQCG8xLIbntMRJMcflrSuhwiAAAAAAEMAAA=",
      "fetchOnlyUnread": false,
      "top": 10
    },
    "host": {
      "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
      "connection": "shared_office365",
      "operationId": "GetEmailsV3"
    }
  },
  "metadata": {
    "operationMetadataId": "94e71b45-f1ca-4bc2-8f63-10c9ef559588"
  }
}
 
 
3. For Each:
{
  "type": "Foreach",
  "foreach": "@outputs('GetEmailsV3')?['body/value']",
  "actions": {
    "Condition": {
      "type": "If",
      "expression": {
        "and": [
          {
            "equals": [
              "@items('ForEach')?['isRead']",
              "True"
            ]
          }
        ]
      },
      "actions": {
        "Move Email": {
          "type": "OpenApiConnection",
          "inputs": {
            "parameters": {
              "messageId": "@items('ForEach')?['id']",
              "folderPath": "Id::AAMkAGZhMWNkY2E5LTg5ZDEtNGRkOC04MWI0LTQwYzhjYzFmYzY1MQAuAAAAAADRvOHmFy9mQpguzszks1X6AQCG8xLIbntMRJMcflrSuhwiAAOR8PL0AAA="
            }
          }
        }
      },
      "else": {
        "actions": {}
      }
    }
  }
}
 
 
4. Condition:
{
  "type": "If",
  "expression": {
    "and": [
      {
        "equals": [
          "@items('ForEach')?['isRead']",
          "True"
        ]
      }
    ]
  },
  "actions": {
    "Move Email": {
      "type": "OpenApiConnection",
      "inputs": {
        "parameters": {
          "messageId": "@items('ForEach')?['id']",
          "folderPath": "Id::AAMkAGZhMWNkY2E5LTg5ZDEtNGRkOC04MWI0LTQwYzhjYzFmYzY1MQAuAAAAAADRvOHmFy9mQpguzszks1X6AQCG8xLIbntMRJMcflrSuhwiAAOR8PL0AAA="
        },
        "host": {
          "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
          "connection": "shared_office365",
          "operationId": "MoveV2"
        }
      }
    }
  },
  "else": {
    "actions": {}
  }
}
 
5. Move Email:
{
  "type": "OpenApiConnection",
  "inputs": {
    "parameters": {
      "messageId": "@items('ForEach')?['id']",
      "folderPath": "Id::AAMkAGZhMWNkY2E5LTg5ZDEtNGRkOC04MWI0LTQwYzhjYzFmYzY1MQAuAAAAAADRvOHmFy9mQpguzszks1X6AQCG8xLIbntMRJMcflrSuhwiAAOR8PL0AAA="
    },
    "host": {
      "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
      "connection": "shared_office365",
      "operationId": "MoveV2"
    }
  },
  "metadata": {
    "Id::AAMkAGZhMWNkY2E5LTg5ZDEtNGRkOC04MWI0LTQwYzhjYzFmYzY1MQAuAAAAAADRvOHmFy9mQpguzszks1X6AQCG8xLIbntMRJMcflrSuhwiAAOR8PL0AAA=": "Einsortieren"
  }
}
 
The issue I'm facing is that the condition in my For Each loop always evaluates to FALSE, even when the `isRead` property should be TRUE. Any advice on how to debug or fix this issue would be greatly appreciated!
Categories:
I have the same question (0)
  • Suggested answer
    MM-04111101-0 Profile Picture
    2 on at
    Ok i found a solution here.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard