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

Indicates the size of a specified message in the currently selected mailbox.

function UIDRetrieveMsgSize(
    const AMsgUID: String
): Integer;
Message unique identifier to access in the mailbox. 

Integer - Bytes required to store the message in the mailbox or -1 when an error occurs.

UIDRetrieveMsgSize is an Integer function that calculates the size of the message unique identifier specified by AMsgUID in the currently selected IMAP4 mailbox. 

UIDRetrieveMsgSize validates the message UID in AMsgUID to ensure that it contains a valid value, and raises an EIdNumberInvalid exception if the requirement is not met. 

UIDRetrieveMsgSize requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised. Use SelectMailBox or ExamineMailBox to select a mailbox prior to calling UIDRetrieveMsgSize. 

UIDRetrieveMsgSize calls SendCMd using the IMAP4 FETCH command to get the message size for the specified UID in the IMAP mailbox. The server response is examined for the message size when the server response contains the value IMAP_OK, and sets the return value for the method. The return value for UIDRetrieveMsgSize is -1 if a protocol error response occurs in the method. 

Use RetrieveMsgSize to retrieve the size of a message using the relative message number for the message. 

Use RetrieveMailBoxSize to retrieve the space required for all messages in the currently selected mailbox for the IMAP4 account.

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