MapiAttachmentBuilder Class

An attachment of an item to write: a file, or an embedded message.

public sealed class MapiAttachmentBuilder

Constructors

NameDescription
MapiAttachmentBuilder()

MapiAttachmentBuilder()

MapiAttachmentBuilder.cs
public MapiAttachmentBuilder()

No documentation is available.

Properties

NameDescription
ContentIdGets or sets the content identifier, which an HTML body uses to show the attachment inline (cid: URLs).
DisplayNameGets or sets the display name of the attachment.
EmbeddedMessageGets or sets the embedded message, for an attachment that is a message.
FileNameGets or sets the file name of the attachment. The writer also uses it as the long file name and the display name when they are not set.
IsHiddenGets or sets whether the attachment is hidden, such as an image shown inline.
LongFileNameGets or sets the full file name of the attachment.
MimeTypeGets or sets the MIME type of the content.
PropertiesGets the properties of the attachment. The other members of the builder read and write them.

Gets or sets the content identifier, which an HTML body uses to show the attachment inline (cid: URLs).

public string? ContentId { get; set; }

Property value

string?

Gets or sets the display name of the attachment.

public string? DisplayName { get; set; }

Property value

string?

Gets or sets the embedded message, for an attachment that is a message.

public MapiMessageBuilder? EmbeddedMessage { get; set; }

Property value

MapiMessageBuilder?

Gets or sets the file name of the attachment. The writer also uses it as the long file name and the display name when they are not set.

public string? FileName { get; set; }

Property value

string?

Gets or sets whether the attachment is hidden, such as an image shown inline.

public bool IsHidden { get; set; }

Property value

bool

Gets or sets the full file name of the attachment.

public string? LongFileName { get; set; }

Property value

string?

Gets or sets the MIME type of the content.

public string? MimeType { get; set; }

Property value

string?

Gets the properties of the attachment. The other members of the builder read and write them.

public MapiPropertyBag Properties { get; }

Property value

MapiPropertyBag

Methods

NameDescription
FromContent(string, byte[], string?)Creates an attachment from the content of a file.
FromMessage(MapiMessageBuilder)Creates an attachment that contains a message.
SetContent(byte[])Sets the content of the attachment.
SetContent(Stream)Sets a stream the writer reads the content of the attachment from, block by block, when it writes the item. The writer does not dispose it.

FromContent(string, byte[], string?)

MapiAttachmentBuilder.cs

Creates an attachment from the content of a file.

public static MapiAttachmentBuilder FromContent(string fileName, byte[] content, string? mimeType = null)

Parameters

fileName string
The file name of the attachment.
content byte[]
The content.
mimeType string?
The MIME type of the content, or null.

Returns

MapiAttachmentBuilder The attachment.

FromMessage(MapiMessageBuilder)

MapiAttachmentBuilder.cs

Creates an attachment that contains a message.

public static MapiAttachmentBuilder FromMessage(MapiMessageBuilder message)

Parameters

message MapiMessageBuilder
The embedded message.

Returns

MapiAttachmentBuilder The attachment.

SetContent overloads

SetContent(byte[])

MapiAttachmentBuilder.cs

Sets the content of the attachment.

public void SetContent(byte[] content)
Parameters
content byte[]
The content.

SetContent(Stream)

MapiAttachmentBuilder.cs

Sets a stream the writer reads the content of the attachment from, block by block, when it writes the item. The writer does not dispose it.

public void SetContent(Stream content)
Parameters
content Stream
The stream of the content, read from its current position.