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
itemIOneNoteItemThe item to get the children of.
Returns
- IReadOnlyList<IOneNoteItem>
Returns the children of the specified
item.
Exceptions
- ArgumentNullException
Thrown if
itemis null.
GetHierarchy(HierarchyScope)
Gets part of the OneNote hierarchy starting from the root to the specified depth.
public static Root GetHierarchy(HierarchyScope depth)
Parameters
depthHierarchyScopeThe depth of the hierarchy to retrieve.
Returns
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
startNodeIdstringThe id of the node to start from.
depthHierarchyScopeThe depth of the hierarchy to retrieve.
Returns
- IOneNoteItem
Returns a partially filled IOneNoteItem.
Exceptions
- ArgumentException
Thrown if
startNodeIdis empty or only whitespace.- ArgumentNullException
Thrown if
startNodeIdis null.
GetParent(IOneNoteItem)
Gets the parent of the specified item from OneNote.
public static IOneNoteItem GetParent(IOneNoteItem item)
Parameters
itemIOneNoteItemThe item to get the parent of.
Returns
Exceptions
- ArgumentNullException
Thrown if
itemis 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
itemIOneNoteItemThe 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
itemIOneNoteItemThe item to update.
depthHierarchyScopeThe depth of the hierarchy to retrieve.
Exceptions
- ArgumentNullException
Thrown if
itemis 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
itemIOneNoteItemThe item to update the parent property of.
Exceptions
- ArgumentNullException
Thrown if
itemis null.