Class Attachment (Outlook VBA)

The class Attachment represents a document or link to a document contained in an Outlook item.


Dim att as Attachment
Set att = Session.CreateSharingItem.Move.GetStorage.Attachments(Index:=1)

For Each

Here is an example of processing the Attachment items in a collection.


Dim att As Attachment
For Each att In Session.CreateSharingItem.Move.GetStorage.Attachments
	
Next att

Methods

Delete - Deletes an object from the collection.

GetTemporaryFilePath - Returns the full path to the attached file that is in a temporary files folder.

SaveAsFile - Saves the attachment to the specified path.

Properties

BlockLevel returns an OlAttachmentBlockLevel constant that specifies if there is any restriction on the attachment based on its file extension.

Class returns an OlObjectClass constant indicating the object's class.

DisplayName returns or sets a String representing the name, which does not need to be the actual file name, displayed below the icon representing the embedded attachment.

FileName returns a String representing the file name of the attachment.

Index returns a Long indicating the position of the object within the collection.

PathName returns a String representing the full path to the linked attached file.

Position returns or sets a Long indicating the position of the attachment within the body of the item.

PropertyAccessor returns a PropertyAccessor object that supports creating, getting, setting, and deleting properties of the parent Attachment object.

Session returns the NameSpace object for the current session.

Size returns a Long indicating the size (in bytes) of the attachment.

Type returns an OlAttachmentType constant indicating the type of the specified object.

NameSpace - Represents an abstract root object for any data source.

PropertyAccessor - Provides the ability to create, get, set, and delete properties on objects.