Item Property


Returns a BodyPartStructure object from the collection.

Index parameter specifies the index of the MIME part structure in the collection. If Index is out of range, automation error occurs.

Item is the default property of the collection. The following two statements (assuming Parts has MailBee.BodyPartStructures type) are equivalent:

Set Part = Parts(1)

and

Set Part = Parts.Item(1)


Value Type: MailBee.BodyPartStructure
Parameters:  
Index As Long Index of the MIME part structure to return. Allowed range is: 1 <= Index <= BodyPartStructures.Count  
Remarks: This property is read-only

Usage example:

' This sample displays the size of the first part of multipart email message.
' The size may be zero if the first part is multipart too.
' For non-multipart message, the size of the body is displayed. 
Dim Mailer, Envelope, Envelopes
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.IMAP4")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.IMAP4")
'In ASP use Response.Write instead of MsgBox
Mailer.EnableLogging = True
Mailer.LogFilePath = "C:\Temp\imap4_log.txt"
Mailer.ClearLog
Mailer.LicenseKey = "put your license key here"
If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then
  If Mailer.SelectMailbox("Inbox") Then
    Set Envelopes = Mailer.RetrieveEnvelopesEx(1, 1, False, True)
    If Not Envelopes Is Nothing Then
      For Each Envelope In Envelopes
        If Envelope.BodyStructure.IsMultipart Then
          MsgBox Envelope.BodyStructure.SubParts(1).Size & " bytes" ' Using Item as Default property
        Else
          MsgBox Envelope.BodyStructure.Size
        End If
      Next
    End If
  End If
  Mailer.Disconnect
End If

See Also:

Count Property

BodyPartStructure Object

BodyPartStructures Collection


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.