Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Check existing folder in user email Imap Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
ibee133
Newbie
Newbie


Joined: 15 August 2006
Location: Thailand
Online Status: Offline
Posts: 1
Posted: 15 August 2006 at 11:00pm | IP Logged Quote ibee133

now when I check for exist folder in imap I 've use this command

ListFolder = IMP.DownloadFolders();
                foreach (Folder EmailFolder in ListFolder)
                {
                     //Folder Created But Not Subcribe
                     if (FolderSysName.Trim() == EmailFolder.ShortName)
......


do you have any command that can check exist folder shorter than this?

thanks
Back to Top View ibee133's Profile Search for other posts by ibee133
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 16 August 2006 at 7:26am | IP Logged Quote Alex

In order to check the folder for existence you can use Imap.GetFolderStatus method which gets the status of the specified folder without selecting it. For example, as follows (in C# syntax):

Code:

Imap imp = new Imap();
// Connect to the server and log into account
imp.Connect("mail.domain.com");
imp.Login("jdoe", "secret");

string folder_name = "Inbox";
                          
// Try to download folder status information
try
{
   FolderStatus status = imp.GetFolderStatus(folder_name);
   Console.WriteLine("The " + folder_name + " folder exists on the server");
}
catch (MailBeeImapNegativeResponseException ex)
{
   Console.WriteLine("The " + folder_name + " folder does not exist on the server");
}

imp.Disconnect();


Best regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide