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 Name | Required Value / Example | Notes |
|---|---|---|
| AppID | 25 | Identifies this feature’s configuration record |
| ActionName | VBAuth – OneNote Notebooks | Display 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 |
| ScopeClaims | Notes.Read | Comma-separated Graph scopes |
| Verb | GET | HTTP method |
| URLPart1 | https://graph.microsoft.com/v1.0/me/onenote/notebooks?$orderby=lastModifiedDateTime desc | Full endpoint including OData sort parameter |
| URLParameter1 | NO VALUE REQUIRED | Not used |
| URLPart2 | NO VALUE REQUIRED | Not used |
| URLParameter2 | NO VALUE REQUIRED | Not used |
| URLPart3 | NO VALUE REQUIRED | Not used |
| WaitForLogin | 60 | Seconds — 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, returningFalsefor 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. isDefaultisTruefor the notebook OneNote designates as the user’s default (typically “My Notebook”). Displayed as[default]in the output.isSharedisTrueif the notebook has been shared with other users. Displayed as[shared]in the output.lastModifiedDateTimeis 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.Readis the correct scope for a read-only listing.Notes.Createis 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
$orderbyparameter 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