ImapSearch Method
Returns the collection of UIDs of all messages in the currently selected folder.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public UidCollection Search()

Return Value

Type: UidCollection
UidCollection object if the command succeeded; otherwise, a null reference (Nothing in Visual Basic).
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks
This method can be used to enumerate UID values of all messages in the folder.
Examples
using System;
using MailBee;
using MailBee.ImapMail;

class Sample
{
    static void Main(string[] args)
    {
        Imap imp = new Imap();

        imp.Connect("mail.host.com");

        imp.Login("jdoe@host.com", "secret");

        // Select Inbox folder.
        imp.SelectFolder("INBOX");

        // Enumerate UIDs into uids variable.
        UidCollection uids = imp.Search();

        // Print UID list as a message set (this message set can then be
        // supplied as messageIndexSet argument of Imap object methods).
        Console.WriteLine("uids as message set (i.e. message sequence):");
        Console.WriteLine(uids.ToString());

        // Print each UID value individually.
        Console.WriteLine();
        Console.WriteLine("uids as a list of UIDs:");
        foreach (long uid in uids)
        {
            Console.WriteLine(uid);
        }

        // Disconnect from the server.
        imp.Disconnect();
    }
}
See Also