IEWSClient client = GetAsposeEWSClient();<o:p></o:p>
//Create ExchangeMailboxInfo instance to save default mailbox info
ExchangeMailboxInfo mailbox = client.GetMailboxInfo();
//Declare variable for getting specified custom folder uri
ExchangeFolderInfo DestfolderInfo = new ExchangeFolderInfo();
//Check if specified custom folder exisits
client.FolderExists(mailbox.InboxUri, "DestinationFolder", out DestfolderInfo);
ExchangeQueryBuilder builder = new ExchangeQueryBuilder();
MailQuery qry = builder.Subject.Equals("Subject to be searched", true);
ExchangeMessageInfoCollection coll = client.ListMessages("Inbox", qry);
if (DestfolderInfo != null)
foreach (ExchangeMessageInfo info in coll)
Assuming there is a folder with name “T1” at the same level as inbox, the following code sample works fine at our end.
IEWSClient client = GetOffice365Account("UserOne@Aspose2016Mar.onmicrosoft.com"); //some test office 365 account
ExchangeMessageInfoCollection msgsColl = client.ListMessages(client.MailboxInfo.InboxUri);
ExchangeFolderInfoCollection subfolders = client.ListSubFolders(client.MailboxInfo.RootUri);
foreach (ExchangeFolderInfo fi in subfolders)
For your other issue of emials fetched at a time limited to 1000, the issue is already known to us and logged as EMAILNET-35159 in our issue tracking system. We’ll update you here once there is some information available in this regard.
Our Product team has investigated this issue and have found it to be configuration settings with Office 365 server that returns result by pages, ignoring client settings. In order to work correctly, please use the paging support with 1000 items per page as detailed in this example.