This project is read-only.

Is there any way to get a set amount of messages on the server?

Sep 16, 2013 at 6:27 PM
hello pavel

Is there any way to get a set amount of messages on the server?

For example, I want to get the 10 latest messages from the server in a particular folder.

I tried to use linq to select last 40 posts, but I noticed that the Date field of the message was not loaded, oh my ordination does not work.

this.Folder.Messages.OrderByDescending return (x => x.Date). Skip (0). Take (40);

because when I try to fetch all messages from my account and have to process each message my app crashes.

My account is 800 messages in the inbox. when you enter this loop below the ScriptTimeout my page bursts.

  foreach (msg ImapX.Message in mesagens)
             {
                 msg.Process ();
             }
Sep 16, 2013 at 7:03 PM
You can use ProcessHeader() instead, which is a lighter-weight call to retrieve basic information (such as the sent and received timestamps) about the message. However, (to the best of my knowledge) Pavel is in the process of updating the APIs so we don't have to call ProcessHeader() any more. He will release this in the next official version due out shortly.

--Ravi
Coordinator
Sep 18, 2013 at 12:52 PM
Good day!

Sorry for the delay, been busy with daily work these days.

The LINQ query is currently being done on the client side, which means first all messages will be downloaded, and then you do the query.

Now you can use the Message.Search method to filter messages on server side and reduce the amount, and as Ravi said, ProcessHeader can be used as temporary solution too. I'm going to release the new version this weekend, so it gets easier for you to download only the data you really need, not everything. I’ll also provide some sample code on that.

Be patient.

Best regards,

Pavel Azanov