How to Get Folder inside Inbox for SharedMail Box in Aspose.Email

Hi,
I have Folder named Test inside Inbox and inside Test i have some Email.How to get that email in Aspose.Currently I am able Fetch mail inside Inbox not inside Test.
Current Code
string[] items = client.ListItems(sharedEmail, “Inbox”);

foreach (string item in items)
{
MapiMessage msg = client.FetchItem(item);
Console.WriteLine(“Subject:” + msg.Subject);
}
client.Dispose();
It is working fine for Inbox.it is not fetching custom folder inside Inbox.How to get that one.If provide some sample code in c# or vb.net it will be helpful.

Thanks!
Suresh

@sureshkumarg

I suggest you to please visit the following thread link for your convenience to access the Shared Mailbox.

image.png (6.5 KB)

how to access SureshFolder.

@sureshkumarg

You may need to add the folder name. In the following image, the example is loading messages from Inbox folder. You may consider setting your own folder name.

Hi ,
i am looking a custom folder outside Inbox.
for ex i have folder inbox,sentitems,drafts,deleteitems and sureshtest.i want to access sureshtest.
my code
Dim messageInfoCol As ExchangeMessageInfoCollection = client.ListMessages(shared.mail, “sureshtest”, false).it is not working.please help.

i am getting error like invalid uri if i am passing the custom folder.

@sureshkumarg

We can check all shared mailbox folders from root:

ExchangeMailboxInfo mi = client.GetMailboxInfo("sharedEmail");
foreach (ExchangeFolderInfo fi in client.ListSubFolders(mi.RootUri))
{
    Console.WriteLine(fi.DisplayName);
    if (fi.DisplayName.Equals("sureshtest"))
    {
        foreach (var m in client.ListMessages(fi.Uri))
        {
            Console.WriteLine(m.Subject);
        }
    }
}
2 Likes

It’s worked for me. Thanks you so much.

@khanh.pham029

It’s good to know that suggested option worked on your end.

1 Like