Class MapiAttachmentCollection

MapiAttachmentCollection class

Represents a strongly-typed collection of MapiAttachment objects that belong to a MAPI message or item. This collection class provides methods for adding, removing, and managing attachments in Outlook messages, including support for embedded messages and file attachments.

public class MapiAttachmentCollection : List<MapiAttachment>

Constructors

NameDescription
MapiAttachmentCollection()Initializes a new instance of the MapiAttachmentCollection class.
MapiAttachmentCollection(MapiMessageItemBase)Initializes a new instance of the MapiAttachmentCollection class.

Methods

NameDescription
Add(MapiAttachment)Adds an object to the end of the Collection.
Add(string, byte[])Adds the new attachment.
Add(string, MapiMessage)Adds the new attachment as embedded message.
Add(string, ReferenceAttachmentOptions)Adds a reference attachment to the collection using the specified name and configuration options.
Insert(int, MapiAttachment)Inserts an element into the Collection at the specified index.
Insert(int, string, MapiMessage)Inserts a message as attachment into the MapiAttachmentCollection at the specified index.
Remove(MapiAttachment)Removes the first occurrence of a specific object from the MapiAttachmentCollection.
RemoveAt(int)Removes the element at the specified index of the MapiAttachmentCollection.
Replace(int, string, MapiMessage)Replaces an element at the specified index.

Remarks

This collection is returned by the Attachments property. Use the Add method to add embedded messages as attachments, and Add to add file-based attachments. The collection supports standard List operations like Add, Remove, and Count.

See Also