# OneNoteFileExtractor

Writes attachments and other payloads from sections and notebooks to a folder, naming each file by its SHA-256 so identical payloads are stored once…

Class 

`OfficeIMO.OneNote`

**Namespace**

`OfficeIMO.OneNote`

**Assembly**

`OfficeIMO.OneNote`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[OneNoteFileExtractor.cs:69](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OneNote/Model/OneNoteFileExtractor.cs#L69)

**Modifiers**

static

Writes attachments and other payloads from sections and notebooks to a folder, naming each file by its SHA-256 so identical payloads are stored once, and reports what it found.

## Inheritance

- object
- OneNoteFileExtractor

Filter members 

Show inherited

## Methods

`public static Func<OneNoteBinaryElement, string?> CreateAssetResolver(string folder, string? uriPrefix = null, long maxFileBytes = 536870912)` [#](#method-createassetresolver-string-string-int64)

[OneNoteFileExtractor.cs:87](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OneNote/Model/OneNoteFileExtractor.cs#L87)

Creates an asset resolver for OneNoteMarkdownExportOptions.AssetUriResolver that writes each payload to folder as <sha256><extension> and returns uriPrefix plus that name. Elements without a payload, such as ink, are left to the converter.

Parameters

**folder string required**

**uriPrefix string? = null optional**

**maxFileBytes long = 536870912 optional**

Returns

`Func<OneNoteBinaryElement, string?>`

Extract 2 overloads

`public static IReadOnlyList<OneNoteExtractedFile> Extract(OneNoteSection section, string folder, OneNoteFileExtractionOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-extract-officeimo-onenote-onenotesection-string-officeimo-onenote-onenotefileextractionoptions-threading-cancellationtoken)

[OneNoteFileExtractor.cs:69](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OneNote/Model/OneNoteFileExtractor.cs#L69)

Writes the selected payloads of a section's current pages to folder.

Parameters

**section OfficeIMO.OneNote.OneNoteSection required**

**folder string required**

**options OfficeIMO.OneNote.OneNoteFileExtractionOptions? = null optional**

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

Returns

`IReadOnlyList<OneNoteExtractedFile>`

Exceptions

- `OperationCanceledException` – cancellationToken was cancelled; files already written are kept.

`public static IReadOnlyList<OneNoteExtractedFile> Extract(OneNoteNotebook notebook, string folder, OneNoteFileExtractionOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-extract-officeimo-onenote-onenotenotebook-string-officeimo-onenote-onenotefileextractionoptions-threading-cancellationtoken)

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

Writes the selected payloads of a notebook's current pages to folder.

Parameters

**notebook OfficeIMO.OneNote.OneNoteNotebook required**

**folder string required**

**options OfficeIMO.OneNote.OneNoteFileExtractionOptions? = null optional**

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

Returns

`IReadOnlyList<OneNoteExtractedFile>`

Exceptions

- `OperationCanceledException` – cancellationToken was cancelled; files already written are kept.

## 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:E4492E715B69977AB66C237180F0C642935B3A27D7708BB24E0841BEF51E477E -->
