Table of Contents

Class OneNote.Partial

Namespace
LinqToOneNote
Assembly
LinqToOneNote.dll

Contains methods that can query parts of the OneNote hierarchy.
This can cause some properties like Children and Parent to be null or empty, even if they have values in OneNote. The Update functions overwrite the existing data in the provided item with the latest data from OneNote.

public static class OneNote.Partial
Inheritance
OneNote.Partial
Inherited Members

Methods

GetChildren(IOneNoteItem)

Shorthand for GetHierarchy(string, HierarchyScope) with the depth parameter set to Children. Returns the children of the specified item.
No update/overwrite occurs.

public static IReadOnlyList<IOneNoteItem> GetChildren(IOneNoteItem item)

Parameters

item IOneNoteItem

The item to get the children of.

Returns

IReadOnlyList<IOneNoteItem>

Returns the children of the specified item.

Exceptions

ArgumentNullException

Thrown if item is null.

GetHierarchy(HierarchyScope)

Gets part of the OneNote hierarchy starting from the root to the specified depth.

public static Root GetHierarchy(HierarchyScope depth)

Parameters

depth HierarchyScope

The depth of the hierarchy to retrieve.

Returns

Root

Returns a partially filled Root.

GetHierarchy(string, HierarchyScope)

Gets part of the OneNote hierarchy starting from the specified startNodeId (Id) to the specified depth.

public static IOneNoteItem GetHierarchy(string startNodeId, HierarchyScope depth)

Parameters

startNodeId string

The id of the node to start from.

depth HierarchyScope

The depth of the hierarchy to retrieve.

Returns

IOneNoteItem

Returns a partially filled IOneNoteItem.

Exceptions

ArgumentException

Thrown if startNodeId is empty or only whitespace.

ArgumentNullException

Thrown if startNodeId is null.

GetParent(IOneNoteItem)

Gets the parent of the specified item from OneNote.

public static IOneNoteItem GetParent(IOneNoteItem item)

Parameters

item IOneNoteItem

The item to get the parent of.

Returns

IOneNoteItem

Returns null if the item is a notebook.

Exceptions

ArgumentNullException

Thrown if item is null.

UpdateChildren(IOneNoteItem)

Shorthand for UpdateHierarchy(IOneNoteItem, HierarchyScope) with the depth parameter set to Children. Updates the children of the specified item.
This overwrites all the existing data in the item.

public static void UpdateChildren(IOneNoteItem item)

Parameters

item IOneNoteItem

The item to update the children of.

UpdateHierarchy(IOneNoteItem, HierarchyScope)

Updates the specified item with part of the OneNote hierarchy to the specified depth. This overwrites all the existing data in the item.
For example, if depth is Children, the Children property of the item is cleared and refilled with the latest data from OneNote.

public static void UpdateHierarchy(IOneNoteItem item, HierarchyScope depth)

Parameters

item IOneNoteItem

The item to update.

depth HierarchyScope

The depth of the hierarchy to retrieve.

Exceptions

ArgumentNullException

Thrown if item is null.

UpdateParent(IOneNoteItem)

Updates the specified item's Parent property with the latest data from OneNote.
Does nothing if the item is a notebook.
Overwrites the existing Parent property.

public static void UpdateParent(IOneNoteItem item)

Parameters

item IOneNoteItem

The item to update the parent property of.

Exceptions

ArgumentNullException

Thrown if item is null.