# OneNotePackageWriter

Creates portable Cabinet-based .onepkg notebook archives.

Class 

`OfficeIMO.OneNote`

**Namespace**

`OfficeIMO.OneNote`

**Assembly**

`OfficeIMO.OneNote`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[OneNotePackageWriter.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OneNote/Writing/OneNotePackageWriter.cs#L9)

**Modifiers**

static

Creates portable Cabinet-based .onepkg notebook archives.

## Inheritance

- object
- OneNotePackageWriter

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Read and Write OneNote Notebooks](/docs/onenote/notebooks/) Guide
  
  Open OneNote notebooks from a folder, a .onetoc2 file or a .onepkg export, walk section groups and sections, and write notebooks offline.

Filter members 

Show inherited

## Methods

Write 3 overloads

`public static byte[] Write(OneNoteNotebook notebook, OneNoteSaveOptions? options = null)` [#](#method-write-officeimo-onenote-onenotenotebook-officeimo-onenote-onenotesaveoptions)

[OneNotePackageWriter.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OneNote/Writing/OneNotePackageWriter.cs#L9)

Serializes a complete notebook to a new .onepkg byte array.

Parameters

**notebook OfficeIMO.OneNote.OneNoteNotebook required**

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

Returns

`byte[]`

`public static void Write(OneNoteNotebook notebook, Stream destination, OneNoteSaveOptions? options = null)` [#](#method-write-officeimo-onenote-onenotenotebook-io-stream-officeimo-onenote-onenotesaveoptions)

[OneNotePackageWriter.cs:36](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OneNote/Writing/OneNotePackageWriter.cs#L36)

Serializes a complete notebook to a caller-owned stream.

Parameters

**notebook OfficeIMO.OneNote.OneNoteNotebook required**

**destination System.IO.Stream required**

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

`public static void Write(OneNoteNotebook notebook, string path, OneNoteSaveOptions? options = null)` [#](#method-write-officeimo-onenote-onenotenotebook-string-officeimo-onenote-onenotesaveoptions)

[OneNotePackageWriter.cs:44](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OneNote/Writing/OneNotePackageWriter.cs#L44)

Serializes a complete notebook to a .onepkg file.

Parameters

**notebook OfficeIMO.OneNote.OneNoteNotebook required**

**path string required**

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

## 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:5CC5738A903D731533769A86EFCD59749C6270222F29C16B228B556C8E17A641 -->
