Topic Path: Symbol Reference > Classes > TIdIMAP4 Class > TIdIMAP4 Methods > RetrieveFlags Method
TIdIMAP4.RetrieveFlags Method

Retrieves stored message flags for a message on the IMAP4 server.

function RetrieveFlags(
    const AMsgNum: Integer; 
    var AFlags: TIdMessageFlagsSet
): Boolean;
Message number containing flags to be retrieved.
Storage for message flags in the specified message number. 

Boolean - True on success.

RetrieveFlags is a Boolean function used to retrieve stored message flags for the relative message number specified AMsgNum. Flags values retrieved from the current mailbox on the IMAP4 server are stored in the AFlags argument. 

RetrieveFlags validates the relative message number in AMsgNum to ensuire that it contains a positive non-zero value, and raises an EIdNumberInvalid exception when AMsgNum contains 0 (zero) or a negative number. 

RetrieveFlags requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised. Use SelectMailBox or ExamineMailBox to select the current mailbox for the IMAP4 account propr to calling RetrieveFlags. 

RetrieveFlags sends the IMAP4 FETCH command to get the flag values for the specified message number. If a protocol response error occurs while retrieving the flag values, RetrieveFlags sets the return value to False and exits from the method. AFlags will contains an empty set in this condition. 

On successful completion, RetrieveFlags processes the untagged responses in IMPAP4 server response, and sets the return value to True. 

Message flags returned in the AFlags argument can be stored in the TIdMessage.Flags property for items in MailBox

Use UIDRetrieveFlags to retrieve message flags for a message using its unique identifier (UID). 

Use StoreFlags to update the stored message flags for a message in the mailbox on the remote IMAP4 server.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.