Attachments.Add Method
Creates a new attachment in the Attachments collection.
Assembly: Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)
[DispIdAttribute()] Attachment Add( Object Source, Object Type, Object Position, Object DisplayName )
Parameters
- Source
- Type: System.Object
The source of the attachment. This can be a file (represented by the full file system path with a file name) or an Outlook item that constitutes the attachment.
- Type
- Type: System.Object
The type of the attachment. Can be one of the OlAttachmentType constants.
- Position
- Type: System.Object
This parameter applies only to e-mail messages using Microsoft Outlook Rich Text format: it is the position where the attachment should be placed within the body text of the message. A value of 1 for the Position parameter specifies that the attachment should be positioned at the beginning of the message body. A value 'n' greater than the number of characters in the body of the e-mail item specifies that the attachment should be placed at the end. A value of 0 makes the attachment hidden.
- DisplayName
- Type: System.Object
This parameter applies only if the mail item is in Rich Text format and Type is set to olByValue: the name is displayed in an Inspector object for the attachment or when viewing the properties of the attachment. If the mail item is in Plain Text or HTML format, then the attachment is displayed using the file name in the Source parameter.
Return Value
Type: Microsoft.Office.Interop.Outlook.AttachmentAn Attachment object that represents the new attachment.