GetFirstHeader Method  
 

Return the first header in the current message part.

Syntax

object.GetFirstHeader( HeaderField, HeaderValue )

HeaderField
A string which will contain the name of the first header field when the method returns. This parameter must be passed by reference.
HeaderValue
A string which will contain the value of the first header field when the method returns. This parameter must be passed by reference.

Return Value

A boolean value of True is returned if the method succeeds, otherwise a value of False is returned. For more information about the cause of the failure, check the value of the LastError property.

Remarks

The GetFirstHeader method allows an application to enumerate all of the headers in the current message. If the current message part does not contain any header fields, this method will return False.

Example

The following example enumerates all of the headers in the main part of the current message and adds them to a listbox:

    Dim strHeader As String, strValue As String
    Dim bResult As Boolean
    
    bResult = InternetMail1.GetFirstHeader(strHeader, strValue)
    Do While bResult
        List1.AddItem strHeader & ": " & strValue
        bResult = InternetMail1.GetNextHeader(strHeader, strValue)
    Loop

See Also

MessagePart Property, GetHeader Method, GetNextHeader Method, SetHeader Method