Skip to main content
Solved

How to Loop Through each mail in Microsoft 365 Outlook for most recent only

  • December 11, 2025
  • 3 replies
  • 28 views

Forum|alt.badge.img+2

I’m using the Loop Through action to loop through each email in Microsoft 365 Outlook, from a specific sender. I am able to save the email, however, I want to restrict to only emails when the received date is on “current date”. I have tried using the built in variable for System Date, but this is not working, it will not retrieve any emails. Is there a different way to set up a date variable to use in this kind of filter that will work well with Outlook?

 

For context, I have also selected “both” for Status of email, and Latest First in the Sort Email options

Best answer by Padmakumar

Hi ​@jane.neasham,

 

Have you converted the System Date value to a String type by specifying the existing Date-Time format within your Outlook?

When you use System:DateTime directly, AA converts it to something like 2025-12-11T15:18:04 (ISO format), which does not exist in the email’s timestamp string. So the bot silently loops through zero results—no error, just no match.

3 replies

Padmakumar
Premier Pathfinder | Tier 7
Forum|alt.badge.img+15
  • Premier Pathfinder | Tier 7
  • Answer
  • December 11, 2025

Hi ​@jane.neasham,

 

Have you converted the System Date value to a String type by specifying the existing Date-Time format within your Outlook?

When you use System:DateTime directly, AA converts it to something like 2025-12-11T15:18:04 (ISO format), which does not exist in the email’s timestamp string. So the bot silently loops through zero results—no error, just no match.


Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • December 11, 2025

Thank you - that has worked!

 

I used the Datetime: To String action to convert the $Systen:Date$ variable to ISO_LOCAL_DATE(‘2011-12-03) and assigned that to a string variable.

I then converted this string variable back to a Datetime variable with the same format ISO_LOCAL_DATE(‘2011-12-03) and then used this date variable to filter the emails to only those sent on the current date.

 

I’m not sure if that was the most efficient way, but it has worked and returned the correct email as expected.


Padmakumar
Premier Pathfinder | Tier 7
Forum|alt.badge.img+15
  • Premier Pathfinder | Tier 7
  • December 11, 2025

Thank you - that has worked!

 

I used the Datetime: To String action to convert the $Systen:Date$ variable to ISO_LOCAL_DATE(‘2011-12-03) and assigned that to a string variable.

I then converted this string variable back to a Datetime variable with the same format ISO_LOCAL_DATE(‘2011-12-03) and then used this date variable to filter the emails to only those sent on the current date.

 

I’m not sure if that was the most efficient way, but it has worked and returned the correct email as expected.

Yes, this is exactly what I meant. 👍🏻