I may be stupid, or just blind… Or both, most likely. But somehow I fail to see how I can specify which folder I want to specify as the root for CreateFolder.
What am I overlooking? Thanks for any tips…
ps: I am using the latest version of Aspose (file version 6.1.0.0, product version 2015.12.31.
Hi Amanuyl,
Thank you for writing to Aspose support team.
You may use following sample code which creates sub-folder under the default Inbox. Please give it a try and let us know the feedback.
static void Test()
{
//How to create a subfolder under the default Inbox
ImapClient imap = GetImapClient();
//Create a subfolder "TestFolderInbox4" under default folder Inbox
imap.CreateFolder("Inbox/TestFolderInbox4");
//List all the folders under Inbox. It should have TestFolderInbox4 as well
ImapFolderInfoCollection collFolder = imap.ListFolders("Inbox", true);
//Select the newly created folder
imap.SelectFolder("Inbox/TestFolderInInbox4");
//Retrieve messages in TestFolderInInbox4. It should return 0 messages
ImapMessageInfoCollection coll = imap.ListMessages();
}
static public ImapClient GetImapClient()
{
Aspose.Email.Imap.ImapClient imap = new Aspose.Email.Imap.ImapClient("imap.gmail.com", 993, "user@gmail.com", "password");
imap.SecurityOptions = SecurityOptions.Auto;
return imap;
}