Getting Folder information from Exchange

Using the ExchangeWebServiceClient, I can’t find a way to get the subfolders from the inbox. I need to list out the folders so that the user can select from it to display only the emails from that subfolder.


What should I be looking for?

Hi Darren,

Sorry for the delayed response.

Please find below the sample source to list all the folders of your Exchange Server Mailbox by using the ExchangeWebServiceClient class. Please use the latest version of Aspose.Email for .NET v1.3.0 for your testing.

C#

var client = new ExchangeWebServiceClient(“https://exchange.domain.com/ews/Exchange.asmx”,
“Username”, “Password”, “Domain”);

var mailbox = client.ListSubFolders(client.MailboxInfo.RootUri);
foreach (var mailboxfolder in mailbox)
{
Console.WriteLine(“Folder " + mailboxfolder.DisplayName);
if (mailboxfolder.ChildFolderCount != 0)
{
var folders = client.ListSubFolders(mailboxfolder.Uri);
foreach (var folder in folders)
{
Console.WriteLine(”\tFolder " + folder.DisplayName);
Console.WriteLine("----------------------------------");
}
}
}