The type of index used when downloading messages.
Message numbers can be indexed either ordinally (i.e. 1, 2, 3, 4) or by Unique Id. The Unique Id is an integer that is uniquely assigned to each message by the IMAP server. To convert an Ordinal message set to a UniqueId message set, check out MessageClient.ToUniqueId().
In this example, the same headers are downloaded for the same message. The message is first referenced via Ordinal Index, and then referenced via UniqueId. From the client's perspective, there isn't any performance difference between accessing a message via Ordinal or UniqueId. However, the implementations may be different server side.
[C#]
IMAP4 imap = new IMAP4( "127.0.0.1" );
imap.Username = "dave@blah.com";
imap.Password = "test";
imap.Login();
//grab the inbox
MailFolder mf = imap.SelectInbox();
//grab the headers of the 1st message
string headers = mf.FetchClient.Headers( 1, IndexType.Ordinal );
//if we have the UID of the message, we can also grab the headers using the UID.
//in this example, manually obtain the uid
int uid = mf.MessageClient.ToUniqueId( 1 );
string headersUid = mf.FetchClient.Headers( uid, IndexType.UniqueId );
imap.Disconnect();
//write the the headers obtained by ordinal index
Console.WriteLine( "headers by ordinal" );
Console.WriteLine( "---------------------" );
Console.WriteLine( headers );
//write out the headers obtained by unique id
Console.WriteLine( "headers by uid" );
Console.WriteLine( "---------------------" );
Console.WriteLine( headersUid );
Console.WriteLine( "Done" );
Console.ReadLine();
[VB.NET]
Dim imap As New IMAP4("127.0.0.1")
imap.Username = "dave@blah.com"
imap.Password = "test"
imap.Login()
'grab the inbox
Dim mf As MailFolder = imap.SelectInbox()
'grab the headers of the 1st message
Dim headers As String = mf.FetchClient.Headers(1, IndexType.Ordinal)
'if we have the UID of the message, we can also grab the headers using the UID.
'in this example, manually obtain the uid
Dim uid As Integer = mf.MessageClient.ToUniqueId(1)
Dim headersUid As String = mf.FetchClient.Headers(uid, IndexType.UniqueId)
imap.Disconnect()
'write the the headers obtained by ordinal index
Console.WriteLine("headers by ordinal")
Console.WriteLine("---------------------")
Console.WriteLine(headers)
'write out the headers obtained by unique id
Console.WriteLine("headers by uid")
Console.WriteLine("---------------------")
Console.WriteLine(headersUid)
Console.WriteLine("Done")
Console.ReadLine()
| Member Name | Description |
|---|---|
| Ordinal | Reference a message via it's ordinal number. |
| UniqueId | Reference a message via it's unique id number. |
Namespace: aspNetIMAP
Assembly: aspNetIMAP (in aspNetIMAP.dll)