# EmailAttachment

Represents a file, inline resource, or embedded item attachment.

Class 

`OfficeIMO.Email`

**Namespace**

`OfficeIMO.Email`

**Assembly**

`OfficeIMO.Email`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[EmailContent.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L48)

**Modifiers**

sealed

Represents a file, inline resource, or embedded item attachment.

## Inheritance

- object
- EmailAttachment

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Read and Convert Email Messages](/docs/email/messages-and-conversion/) Guide
  
  Read EML, MSG, OFT, and TNEF (winmail.dat) messages, convert between them, check for conversion loss, stream large attachments, and render a message to PDF.

## Usage

Explore 9 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 4

- Property [EmailAttachmentPatchChange.Attachment](/api/email/officeimo-email-emailattachmentpatchchange/#property-attachment)
- Property [EmailDocument.Attachments](/api/email/officeimo-email-emaildocument/#property-attachments)
- Property [EmailProtectionInfo.PayloadAttachment](/api/email/officeimo-email-emailprotectioninfo/#property-payloadattachment)
- Property [OutlookTaskCommunication.PayloadAttachment](/api/email/officeimo-email-outlooktaskcommunication/#property-payloadattachment)

### Accepted by parameters 5

- Method [EmailAttachmentPatch.Add](/api/email/officeimo-email-emailattachmentpatch/#method-add-officeimo-email-emailattachment) parameter `attachment`
- Method [EmailAttachmentPatch.Apply](/api/email/officeimo-email-emailattachmentpatch/#method-apply-collections-generic-ilist-officeimo-email-emailattachment) parameter `attachments`
- Method [EmailAttachmentPatch.ReplaceAt](/api/email/officeimo-email-emailattachmentpatch/#method-replaceat-int32-officeimo-email-emailattachment) parameter `attachment`
- Method [EmailAttachmentPatch.Validate](/api/email/officeimo-email-emailattachmentpatch/#method-validate-collections-generic-ilist-officeimo-email-emailattachment) parameter `attachments`
- Method [EmailAttachmentTextReader.Read](/api/email/officeimo-email-emailattachmenttextreader/#method-read-officeimo-email-emailattachment-int64-threading-cancellationtoken) parameter `attachment`

Filter members 

Show inherited

## Constructors

`public EmailAttachment()` [#](#constructor-ctor)

[EmailContent.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L48)

## Methods

`public Stream OpenContentStream()` [#](#method-opencontentstream)

[EmailContent.cs:117](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L117)

Opens decoded attachment content without transferring ownership of the attachment.

Returns

`Stream`

`public async Task<Stream> OpenContentStreamAsync(CancellationToken cancellationToken = default)` [#](#method-opencontentstreamasync-threading-cancellationtoken)

Asynchronously opens decoded attachment content.

Parameters

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<Stream>`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public string? FileName { get; set; }` [#](#property-filename)

[EmailContent.cs:62](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L62)

Attachment filename.

`public string? ContentType { get; set; }` [#](#property-contenttype)

[EmailContent.cs:65](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L65)

Declared MIME content type.

`public IDictionary<string, string> ContentTypeParameters { get; }` [#](#property-contenttypeparameters)

[EmailContent.cs:68](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L68)

Declared MIME content-type parameters other than the attachment filename.

`public string? ContentId { get; set; }` [#](#property-contentid)

[EmailContent.cs:71](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L71)

Content-ID used by inline references.

`public string? ContentLocation { get; set; }` [#](#property-contentlocation)

[EmailContent.cs:74](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L74)

Content location used by inline references.

`public bool IsInline { get; set; }` [#](#property-isinline)

[EmailContent.cs:77](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L77)

True when the source marks the attachment as inline.

`public bool IsMimeRelated { get; set; }` [#](#property-ismimerelated)

[EmailContent.cs:83](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L83)

True when the source places this part inside the MIME related-resource set. Writers also infer related membership from exact HTML Content-ID and Content-Location references.

`public bool IsHidden { get; set; }` [#](#property-ishidden)

[EmailContent.cs:86](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L86)

True when Outlook marks the attachment hidden.

`public bool IsContactPhoto { get; set; }` [#](#property-iscontactphoto)

[EmailContent.cs:89](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L89)

True when the attachment is the picture for an Outlook contact.

`public int RenderingPosition { get; set; }` [#](#property-renderingposition)

[EmailContent.cs:92](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L92)

RTF rendering position, or -1 when not rendered in the body.

`public DateTimeOffset? CreatedDate { get; set; }` [#](#property-createddate)

[EmailContent.cs:95](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L95)

Attachment creation timestamp.

`public DateTimeOffset? ModifiedDate { get; set; }` [#](#property-modifieddate)

[EmailContent.cs:98](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L98)

Attachment modification timestamp.

`public string? LinkedPath { get; set; }` [#](#property-linkedpath)

[EmailContent.cs:101](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L101)

Linked attachment path for by-reference attachment methods.

`public long Length { get; set; }` [#](#property-length)

[EmailContent.cs:104](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L104)

Decoded payload length.

`public byte[]? Content { get; set; }` [#](#property-content)

[EmailContent.cs:107](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L107)

Decoded content when requested by reader options.

`public IEmailContentSource? ContentSource { get; set; }` [#](#property-contentsource)

[EmailContent.cs:113](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L113)

Reopenable decoded content used when retaining a byte array is undesirable. Writers prefer [EmailAttachment.Content](/api/email/officeimo-email-emailattachment/) when both representations are present.

`public EmailDocument? EmbeddedDocument { get; set; }` [#](#property-embeddeddocument)

[EmailContent.cs:145](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L145)

Embedded message or Outlook item when the attachment is structured.

`public int? MapiAttachMethod { get; set; }` [#](#property-mapiattachmethod)

[EmailContent.cs:148](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L148)

MSG attachment method, such as 1 for by-value or 5 for embedded message.

`public IList<MapiProperty> MapiProperties { get; }` [#](#property-mapiproperties)

[EmailContent.cs:151](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L151)

Attachment-level MAPI properties.

`public MapiPropertyBag Mapi { get; }` [#](#property-mapi)

[EmailContent.cs:154](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L154)

Typed MAPI access backed by the exact [EmailAttachment.MapiProperties](/api/email/officeimo-email-emailattachment/) collection.

`public IDictionary<string, byte[]> StructuredStorageStreams { get; }` [#](#property-structuredstoragestreams)

[EmailContent.cs:157](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L157)

Relative CFB streams retained for an OLE, embedded MSG, or custom-storage attachment.

`public IList<TnefAttribute> TnefAttributes { get; }` [#](#property-tnefattributes)

[EmailContent.cs:160](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Model/EmailContent.cs#L160)

Ordered raw attachment-level TNEF attributes.

<!-- PowerForge markdown artifact sha256:8C4C35FF7A6D060045187C692FCB62BC8FD78DFB65580C627FD14FA1CE1C67EC -->
