MapiFile (VB)

The Visual Basic MapiFile type contains file attachment information.

Quick Info

Header file:

MAPIVB32.BAS

 

Type MapiFile
     Reserved as Long
     Flags as Long
     Position as Long
     PathName as String
     FileName as String
     FileType as String
End Type 

 

Members

Reserved

Reserved; must be zero.

Flags

Bitmask of flags. The following flags can be set:

MAPI_OLE

The attachment is an OLE object file attachment. If MAPI_OLE_STATIC is also set, the object is static. If neither flag is set, the attachment is simply a data file.

MAPI_OLE_STATIC

The attachment is a static OLE object file attachment.

Position

An integer used to determine where the attachment should be placed in the message text. Attachments replace the character found at a certain position in the message text; in other words, attachments replace the MapiMessage member NoteText[Position]. Applications cannot place two attachments in the same location within a message, and attachments cannot be placed beyond the end of the message text. MAPIReadMail does not return an attachment with the value of Position equal to -1 unless the MAPI_BODY_AS_FILE flag is set.

PathName

The full path of the attached file. The file should be closed before this call is made.

FileName

The filename seen by the recipient. This name can differ from the filename in the PathName member if temporary files are being used. If the FileName member is empty, the filename from PathName is used. If the attachment is an OLE object, FileName contains the class name of the object, such as  Microsoft Excel Worksheet. 

FileType

A reserved descriptor that indicates to the recipient the type of the attached file. An empty string indicates an unknown or operating system-determined file type. With this release, you must use an empty string, "", for this parameter.

 

Remarks

Simple MAPI for Visual Basic supports the following kinds of attachments:

    Data files

    Embedded OLE objects

    Static OLE objects

 

The Flags member determines the kind of attachment. OLE object files are file representations of OLE object streams. You can re-create an OLE object from the file by calling the OLE function OleLoadFromStream with an OLESTREAM object that reads the file contents. If an OLE file attachment is included in an outbound message, the OLE object stream should be written directly to the file used as the attachment.