Fetch limited no of mails

Topics: Help requests
Nov 27, 2014 at 5:19 AM
Edited Nov 28, 2014 at 4:32 AM
Hello, i am working with imapx in c# wpf i am able to authenticate and login to the email address now for get the mails i use following line

ImapClient.Folders.Inbox.Search().OrderByDescending( => .Date).ToList();

to get mails from my Inbox but it takes so much of time, so i am trying to get first 20 mails from the inbox how should i achieve it
Coordinator
Nov 29, 2014 at 11:10 AM
Hi viju5611,

the search method has various overloads which allow you to specify the count of messages you want to fetch. A quick sample:
client.Folders.Inbox.Search("ALL", MessageFetchMode.ClientDefault, 20);
Greets,

Pavel
Nov 29, 2014 at 12:45 PM
i tried by this way also but result is the same, again it takes the same time and load all the mails..