Free Support Forum - aspose.com

The FolderType is always ImapSpecialFolderTypes.NotSpecified when I use Aspose.Email.Clients.Imap.ImapClient.ListFolders

The FolderType is always ImapSpecialFolderTypes.NotSpecified when I use Aspose.Email.Clients.Imap.ImapClient.ListFolders

@gavin.zhao,

I have observed the requirements shared by you and request you to please share the working sample code along with test account access so that we may try to access and investigate the issue further on our end.

Hi @mudassir.fayyaz
I want to get the folder’s flag info such as archive drafts sent spam and trash, I can get the flag info by S22.Imap.ImapClient.
The folderType return by aspose client is always NotSpecified

The code is:
var asposeClient = new Aspose.Email.Clients.Imap.ImapClient(serverHost, port, userName, password, RemoteCertificateValidationCallback, Aspose.Email.Clients.SecurityOptions.SSLAuto);
var folders = asposeClient.ListFolders();

@gavin.zhao,

I have observed your requirements and suggest you to please try using the this over load method for ListFolders(Boolean val) on your to retrieve all the information from folder that can be viewed using FolderInfo class. I hope the shared information will be helpful.

@mudassir.fayyaz
It doesn’t work, the folder type is also NotSpecified

@gavin.zhao,

I have observed your comments and like to share that Aspose.Email can only check FolderType or Remote/NonExistent flags. You can please try using following sample code on your end.

using (ImapClient client = TestUtil.CreateImapClient())
{
    ImapFolderInfoCollection folderInfoColl = client.ListFolders();
    foreach (ImapFolderInfo folderInfo in folderInfoColl)
    {
        if (folderInfo.Remote)
            Console.WriteLine("Folder is a remote mailbox");
        if (folderInfo.NonExistent)
            Console.WriteLine("Is not referred to an existing folder");

    }
}