CFIMAP action GetAll loop start from latest

Participant ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Hello community, hope you are all doing well and safe.

I am running a script to insert all email information within a particular folder to a Database table.

It is working fine but it is starting form the oldest ones instead of the most recent ones.

This is my cfimap block:

 

2020-05-07_14-01-31.png

I am doing 4 emails at the time otherwise the process is slow.

Is there a way to revert the "get all" order, getting the most recenct first?

 

Thank you in advance!

Views

522

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 08, 2020 May 08, 2020

Copy link to clipboard

Copied

LATEST

Hi, Dani,

 

CFIMAP returns a query object.. so instead of trying to retrieve newest to oldest, get only the unread emails and loop backwards through the query to process in the order you want.

 

HTH,

 

^ _ ^

 

(UNTESTED, I've never used CFIMAP, so this is just a guess.)

 

UPDATE:  Okay, I don't know that it returns a query object.  If it doesn't, you can easily create a query object by iterating the results, and then use that query object sorted by date descending to insert into your database.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines