class RecentNotebook
A data class representing a recently accessed OneNote notebook with display name and navigation links.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/notebooks/recent.py
5 - 16
simple
Purpose
RecentNotebook is a lightweight representation of a OneNote notebook that has been recently accessed by a user. It extends ClientValue and provides essential information about the notebook including its display name and links for opening it in different OneNote clients (desktop application or web interface). This class is used in the Microsoft Graph API integration for OneNote to track and provide quick access to recently used notebooks.
Source Code
class RecentNotebook(ClientValue):
"""A recently accessed OneNote notebook. A recentNotebook is similar to a notebook but has fewer properties."""
def __init__(self, display_name=None, links=RecentNotebookLinks()):
"""
:param str display_name: The name of the notebook.
:param RecentNotebookLinks links: Links for opening the notebook.
The oneNoteClientURL link opens the notebook in the OneNote client, if it's installed.
The oneNoteWebURL link opens the notebook in OneNote on the web.
"""
self.displayName = display_name
self.links = links
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
display_name: The human-readable name of the notebook as it appears in OneNote. This is an optional string parameter that defaults to None if not provided. It represents the title or label that users see when browsing their notebooks.
links: A RecentNotebookLinks object containing URLs for accessing the notebook through different OneNote clients. Defaults to an empty RecentNotebookLinks() instance. This object typically contains oneNoteClientURL (for opening in the desktop client) and oneNoteWebURL (for opening in the web browser).
Return Value
Instantiation returns a RecentNotebook object with two instance attributes: displayName (str or None) and links (RecentNotebookLinks). The object represents a recently accessed notebook and can be used to retrieve notebook information or generate access links. As a ClientValue subclass, it can be serialized for API communication.
Class Interface
Methods
__init__(display_name=None, links=RecentNotebookLinks()) -> None
Purpose: Initializes a new RecentNotebook instance with the provided display name and links
Parameters:
display_name: Optional string representing the notebook's display name, defaults to Nonelinks: RecentNotebookLinks object containing URLs for accessing the notebook, defaults to empty RecentNotebookLinks()
Returns: None - constructor initializes the instance
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
displayName |
str or None | The name of the notebook as displayed to users in OneNote interfaces | instance |
links |
RecentNotebookLinks | Object containing oneNoteClientURL and oneNoteWebURL links for opening the notebook in different OneNote clients | instance |
Dependencies
office365
Required Imports
from office365.onenote.notebooks.recent_links import RecentNotebookLinks
from office365.runtime.client_value import ClientValue
Usage Example
from office365.onenote.notebooks.recent_notebook import RecentNotebook
from office365.onenote.notebooks.recent_links import RecentNotebookLinks
# Create a recent notebook with just a name
notebook1 = RecentNotebook(display_name="My Work Notes")
# Create a recent notebook with name and links
links = RecentNotebookLinks()
notebook2 = RecentNotebook(
display_name="Project Planning",
links=links
)
# Access the notebook properties
print(notebook2.displayName) # Output: Project Planning
print(notebook2.links) # Output: RecentNotebookLinks object
# Typically used when retrieving recent notebooks from Microsoft Graph API
# The API would populate these objects with data from the service
Best Practices
- Always provide a meaningful display_name when creating instances manually to ensure notebooks are identifiable
- Use the default RecentNotebookLinks() constructor unless you have specific link URLs to provide
- This class is typically instantiated by the Office365 SDK when deserializing API responses rather than manually by developers
- As a ClientValue subclass, instances can be serialized for API requests and deserialized from API responses
- The class is immutable by design - attributes should be set during initialization rather than modified after creation
- When working with the Microsoft Graph API, these objects are usually returned as part of collections from recent notebook queries
- Ensure proper authentication is configured before attempting to use this class with live OneNote data
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class RecentNotebookLinks 80.7% similar
-
class Notebook 68.2% similar
-
class Onenote 64.0% similar
-
class NotebookCollection 63.6% similar
-
class CopyNotebookModel 63.4% similar