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 / %RetrievedEmails[0]% d...
Power Automate
Answered

%RetrievedEmails[0]% does not get the latest message via IMAP

(0) ShareShare
ReportReport
Posted on by 5

I am using %RetrievedEmails[0]% to make only the latest message unread in the Inbox of an IMAP mailbox.

First I retrieve emails and mark them as read

Then I process email messages with variable %RetrievedEmails[0]% to mark the latest message as unread

For some reason this is selecting a message somewhere about 18 into the inbox. If I use %RetrievedEmails[18]% it selects the latest message.


Any idea what may cause this? Is there a simple way of getting latest message via IMAP?

Thanks

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Have never actually noticed this myself, but I assume it likely goes in the reverse order and starts with oldest messages. You can either use Sort list to sort it by item properties, or simply pick up the last item instead of the first one. You can get it as %RetrievedEmails[RetrievedEmails.Count-1]%.

  • SimonF Profile Picture
    5 on at

    That did the trick, 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 275 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 235

#3
David_MA Profile Picture

David_MA 178 Super User 2026 Season 2

Last 30 days Overall leaderboard