Share via


AttachmentCollection.Add method (String, String)

The Add method adds a new Attachment object to the collection by using the file name specified by the fileName parameter and the content type specified by the contentType parameter.

Namespace:  Microsoft.Exchange.Data.Transport.Email
Assembly:  Microsoft.Exchange.Data.Transport (in Microsoft.Exchange.Data.Transport.dll)

Syntax

'Declaration
Public Function Add ( _
    fileName As String, _
    contentType As String _
) As Attachment
'Usage
Dim instance As AttachmentCollection
Dim fileName As String
Dim contentType As String
Dim returnValue As Attachment

returnValue = instance.Add(fileName, contentType)
public Attachment Add(
    string fileName,
    string contentType
)

Parameters

  • fileName
    Type: System.String

    The file name for the attachment to add to the collection.

  • contentType
    Type: System.String

    The content type for the attachment to add to the collection.

Return value

Type: Microsoft.Exchange.Data.Transport.Email.Attachment

Remarks

If the contentType parameter is null or empty, the method uses application/octet-stream for the value of the contentType parameter.

See also

Reference

AttachmentCollection class

AttachmentCollection members

Add overload

Microsoft.Exchange.Data.Transport.Email namespace