Pop3BeginDeleteMessages Method |
Note: This API is now obsolete.
Namespace: MailBee.Pop3Mail
[ObsoleteAttribute("This method is obsolete in .NET 4.5+. Use DeleteMessagesAsync instead.")] public IAsyncResult BeginDeleteMessages( int startIndex, int count, AsyncCallback callback, Object state )
Exception | Condition |
---|---|
MailBeeInvalidStateException | There is already an operation in progress. |
// To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Pop3Mail; // Put the code below inside your class. // The actual code. private void Form1_Load(object sender, System.EventArgs e) { Pop3 pop = new Pop3(); // Let MailBee process events. pop.RaiseEventsViaMessageLoop = false; pop.Connect("pop.somehost.com"); pop.Login("jdoe", "secret"); // Initiate an asynchronous deletion attempt. pop.BeginDeleteMessages(pop.InboxMessageCount - 4, 5, null, null); // Simulate some lengthy work here... for (int i = 0; i < 100; i++) { // Make a portion of the work. System.Threading.Thread.Sleep(10); // Process events which were raised during execution of the work above. pop.Wait(0); } // End the message flagging operation. If it's in progress at the moment // this method starts, it will wait until it's done first. pop.EndDeleteMessages(); // Disconnect from the server. pop.Disconnect(); }