# EmailAttachmentExtractor

Exports attachment bytes to a caller-controlled directory with portable names and atomic commits.

Class 

`OfficeIMO.Email`

**Namespace**

`OfficeIMO.Email`

**Assembly**

`OfficeIMO.Email`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[EmailAttachmentExtractor.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Email/Export/EmailAttachmentExtractor.cs#L18)

**Modifiers**

static

Exports attachment bytes to a caller-controlled directory with portable names and atomic commits.

## Inheritance

- object
- EmailAttachmentExtractor

Filter members 

Show inherited

## Methods

`public static EmailAttachmentExtractionResult Extract(EmailDocument document, string destinationDirectory, EmailAttachmentExtractionOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-extract-officeimo-email-emaildocument-string-officeimo-email-emailattachmentextractionoptions-threading-cancellationtoken)

[EmailAttachmentExtractor.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Email/Export/EmailAttachmentExtractor.cs#L18)

Extracts attachments without overwriting existing files, opening linked paths, or modifying the model. Keep the destination under the caller's control while extraction runs. The returned manifest contains source names and paths; treat it as mail data. Earlier completed files survive cancellation or later failures. Source operations run on a worker so asynchronous content providers cannot capture a blocked UI context.

Parameters

**document OfficeIMO.Email.EmailDocument required**

**destinationDirectory string required**

**options OfficeIMO.Email.EmailAttachmentExtractionOptions? = null optional**

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

Returns

`EmailAttachmentExtractionResult`

`public static async Task<EmailAttachmentExtractionResult> ExtractAsync(EmailDocument document, string destinationDirectory, EmailAttachmentExtractionOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-extractasync-officeimo-email-emaildocument-string-officeimo-email-emailattachmentextractionoptions-threading-cancellationtoken)

Asynchronously stages source content and exports attachments under the same bounds as [EmailAttachmentExtractor.Extract](/api/email/officeimo-email-emailattachmentextractor/).

Parameters

**document OfficeIMO.Email.EmailDocument required**

**destinationDirectory string required**

**options OfficeIMO.Email.EmailAttachmentExtractionOptions? = null optional**

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

Returns

`Task<EmailAttachmentExtractionResult>`

## 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?`

<!-- PowerForge markdown artifact sha256:A3EAA0C305FA4A81A2C1EF58BF75D378F6CB81410C1502030F51A66435B2C42A -->
