Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OneNoteFileExtractor

OfficeIMO.OneNote

Namespace
OfficeIMO.OneNote
Assembly
OfficeIMO.OneNote
Source revision
be6c300e4ab1 with working tree changes
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

Methods

public static Func<OneNoteBinaryElement, string?> CreateAssetResolver(string folder, string? uriPrefix = null, long maxFileBytes = 536870912) #

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) #

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) #

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.