ImapUidValidity Property
Gets the UIDVALIDITY value of the currently selected folder.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public long UidValidity { get; }

Property Value

Type: Int64
A 32-bit positive value containing the UIDVALIDITY of the currently selected folder, or 0 if no folder is selected.
Remarks

If UIDs from an earlier session fail to persist in this session, the UIDVALIDITY value MUST be greater than the one used in the earlier session.

Thus, the client should remember UidValidity value of each folder and compare the saved value and new value on next session. If new value is larger, it means the mail server is not capable of keeping UIDs unchanged between sessions. In this case, the client cannot make any assumptions that UIDs obtained during the previous session correspond to UIDs of the same messages on this session.

Nowadays, IMAP4 servers which fail to persist UIDs between session are very uncommon, and the UIDVALIDITY value is usually the same accross sessions. Nevertheless, the client should still check the UIDVALIDITY value due to the following reason: if, between two sessions, the folder was deleted and the folder with the same name was recreated, and this new folder was filled with some mails, their UIDs may coincide with UIDs of the messages in the original folder (which is now deleted). To avoid confusion, the application should check if UIDVALIDITY had changed.

See Also