MailBee.NET Objects 3.1

MailMessage.UidOnServer Property

Gets Unique-ID (UID) of the message in the mailbox on the server.

public object UidOnServer {get;}

Property Value

Returns a null reference (Nothing in Visual Basic) if the message was not received from the mail server; if received from IMAP4 server, returns a long value (Int64) containing positive 32bit value of IMAP4 UID, or -1 if UID could not be retrieved; if received from POP3 server, returns a string containing POP3 UID of this message, or a null reference if the UID value is not available.

Remarks

By default, MailBee does not download the list of POP3 UIDs unless any method which accesses UIDs (such as GetMessageUids) is called. To make sure UIDs are downloaded, set Uidl flag in InboxPreloadOptions property value prior to connecting to the POP3 server. However, some old POP3 servers do not support UIDs, and thus this property will still return null if UIDs are not supported by the server.

Note   The developer should use type casting from Object when using this property.

Example

This sample shows how to obtain UID values of two messages (one received from POP3 server while another - from IMAP4 server).

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// Assume msgPop3 and msgImap are MailMessage objects which already
// have been received from POP3 and IMAP4 servers.
string pop3Uid = (string)msgPop3.UidOnServer;
long imapUid = (long)msgImap.UidOnServer;
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

' Assume msgPop3 and msgImap are MailMessage objects which already
' have been received from POP3 and IMAP4 servers.
Dim pop3UID As String = CType(msgPop3.UidOnServer, String)
Dim imapUid As Long = CType(msgImap.UidOnServer, Long)

See Also

MailMessage Class | MailBee.Mime Namespace