README OneNote Notebooks

README OneNote Notebooks #

Overview #

Retrieves all OneNote notebooks owned by the signed-in user, ordered by last modified date descending, via a single Graph API call. Authentication is via OAuth2 with MFA support using VBAuth.dll. Each notebook entry shows its display name, last modified date, and flags for whether it is the user’s default notebook or is shared. Only notebooks owned by the signed-in user are returned; notebooks shared with the user but owned by others do not appear in this endpoint’s results.

Office apps #

  • Access (tested M365)
  • Excel (untested M365)

Required components #

  • VBAuth.dll v1.x
  • modVBAuthGlobalConstants.bas (from /shared)
  • modListOneNoteNotebooks.bas (this module)

Azure Entra App Registration #

Delegated permissions:

  • Notes.Read

Admin consent is required before users can authenticate.

VBAuth Admin Table – Required Values #

Column NameRequired Value / ExampleNotes
AppID25Identifies this feature’s configuration record
ActionNameVBAuth – OneNote NotebooksDisplay name — any value acceptable
ClientID(your App Client ID)GUID from Azure App Registration Overview blade
TenantID(your Tenant ID)GUID from Azure App Registration Overview blade
ObjectID(your Object ID)Set by PopulateMissingObjectIDs
ScopeClaimsNotes.ReadComma-separated Graph scopes
VerbGETHTTP method
URLPart1https://graph.microsoft.com/v1.0/me/onenote/notebooks?$orderby=lastModifiedDateTime descFull endpoint including OData sort parameter
URLParameter1NO VALUE REQUIREDNot used
URLPart2NO VALUE REQUIREDNot used
URLParameter2NO VALUE REQUIREDNot used
URLPart3NO VALUE REQUIREDNot used
WaitForLogin60Seconds — NB MSXML2 timeout parameters are in milliseconds

Module: modListOneNoteNotebooks.bas #

Public functions #

Public Function ListOneNoteNotebooks( _
    ByRef strResult As String, _
    ByRef strMessage As String) As Boolean
Code language: JavaScript (javascript)

Acquires a bearer token for AppID 25 (Notes.Read) and calls GET /me/onenote/notebooks?$orderby=lastModifiedDateTime desc. Returns True on success. strResult receives the formatted display text. strMessage receives a summary count on success or an error description on failure.

Private functions #

  • SafeString(objItem, strKey) — returns a string field from a parsed JSON Dictionary, returning "" for absent fields without error.
  • SafeBool(objItem, strKey) — returns a Boolean field from a parsed JSON Dictionary, returning False for absent fields without error.

Behaviour #

  • Runs as the signed-in user (delegated permissions only — the OneNote API does not support app-only authentication).
  • HTTP 200 is the success code.
  • Results are ordered by lastModifiedDateTime desc — most recently modified notebook first. This ordering is applied server-side via OData $orderby; no client-side sorting is performed.
  • isDefault is True for the notebook OneNote designates as the user’s default (typically “My Notebook”). Displayed as [default] in the output.
  • isShared is True if the notebook has been shared with other users. Displayed as [shared] in the output.
  • lastModifiedDateTime is returned in ISO 8601 UTC format; only the date portion (yyyy-mm-dd) is displayed.
  • If the user has no notebooks, a “no notebooks found” message is returned rather than an error.
  • Authentication is interactive on first run; subsequent calls within the session reuse the cached token.

Notes #

  • Notes.Read is the correct scope for a read-only listing. Notes.Create is documented as the least privileged scope but is semantically misleading for a read-only operation.
  • This endpoint returns only notebooks the signed-in user owns. Notebooks shared with the user by others are not included.
  • Admin consent is required before users can authenticate.
  • The OData $orderby parameter is stored directly in URLPart1 as part of the base URL. No runtime URL assembly is needed.

VBAuth, developed and maintained by Andrew Richards (The IT Service Ltd) and Peter Bryant (Corylus Business Systems), © 2025–2026. All rights reserved. https://vbauth.com

Updated on April 3, 2026