🔍 Code Extractor

class RecentNotebookLinks

Maturity: 48

A data class representing links for opening a OneNote notebook, containing both client and web URLs for accessing the notebook.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/notebooks/recent_links.py
Lines:
5 - 14
Complexity:
simple

Purpose

This class serves as a data container for OneNote notebook access links. It inherits from ClientValue and is designed to be used as a property on a recentNotebook resource, providing two types of links: one for opening the notebook in the OneNote client application and another for opening it in a web browser. This class is part of the Office 365 OneNote API integration and facilitates multi-platform access to OneNote notebooks.

Source Code

class RecentNotebookLinks(ClientValue):
    """
    Links for opening a OneNote notebook. This resource type exists as a property on a recentNotebook resource.
    """

    def __init__(
        self, onenote_client_url=ExternalLink(), onenote_web_url=ExternalLink()
    ):
        self.oneNoteClientUrl = onenote_client_url
        self.oneNoteWebUrl = onenote_web_url

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

onenote_client_url: An ExternalLink object representing the URL to open the notebook in the OneNote desktop or mobile client application. Defaults to an empty ExternalLink() instance if not provided.

onenote_web_url: An ExternalLink object representing the URL to open the notebook in the OneNote web interface. Defaults to an empty ExternalLink() instance if not provided.

Return Value

Instantiation returns a RecentNotebookLinks object with two attributes: oneNoteClientUrl and oneNoteWebUrl, both of type ExternalLink. These attributes store the respective URLs for accessing the OneNote notebook through different interfaces.

Class Interface

Methods

__init__(self, onenote_client_url=ExternalLink(), onenote_web_url=ExternalLink())

Purpose: Initializes a RecentNotebookLinks instance with URLs for accessing a OneNote notebook via client and web interfaces

Parameters:

  • onenote_client_url: ExternalLink object for the OneNote client application URL, defaults to empty ExternalLink()
  • onenote_web_url: ExternalLink object for the OneNote web interface URL, defaults to empty ExternalLink()

Returns: None (constructor)

Attributes

Name Type Description Scope
oneNoteClientUrl ExternalLink Stores the URL link for opening the notebook in the OneNote client application (desktop or mobile) instance
oneNoteWebUrl ExternalLink Stores the URL link for opening the notebook in the OneNote web interface instance

Dependencies

  • office365

Required Imports

from office365.onenote.pages.external_link import ExternalLink
from office365.runtime.client_value import ClientValue
from office365.onenote.recent_notebook_links import RecentNotebookLinks

Usage Example

from office365.onenote.pages.external_link import ExternalLink
from office365.onenote.recent_notebook_links import RecentNotebookLinks

# Create ExternalLink objects
client_link = ExternalLink()
client_link.href = 'onenote:https://example.com/notebook'

web_link = ExternalLink()
web_link.href = 'https://www.onenote.com/notebooks/example'

# Instantiate RecentNotebookLinks with custom links
notebook_links = RecentNotebookLinks(
    onenote_client_url=client_link,
    onenote_web_url=web_link
)

# Access the links
print(notebook_links.oneNoteClientUrl.href)
print(notebook_links.oneNoteWebUrl.href)

# Or use default empty links
default_links = RecentNotebookLinks()
print(default_links.oneNoteClientUrl)
print(default_links.oneNoteWebUrl)

Best Practices

  • This class is a simple data container with no methods beyond initialization, so it should be instantiated with appropriate ExternalLink objects
  • The class uses camelCase for attribute names (oneNoteClientUrl, oneNoteWebUrl) to match Microsoft Graph API conventions, even though constructor parameters use snake_case
  • Always ensure ExternalLink objects are properly initialized with valid URLs before passing them to this class
  • This class is typically not instantiated directly by end users but rather populated by the Office 365 API when retrieving recent notebook information
  • Since it inherits from ClientValue, it may be serialized/deserialized as part of API requests and responses
  • The class is immutable after construction - attributes should be set during initialization rather than modified later
  • When using in API contexts, the class will be automatically serialized to match the expected JSON structure for Microsoft Graph API

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class ExternalLink 80.8% similar

    A simple data class that represents a URL link to a OneNote page or notebook, inheriting from ClientValue.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/pages/external_link.py
  • class RecentNotebook 80.7% similar

    A data class representing a recently accessed OneNote notebook with display name and navigation links.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/notebooks/recent.py
  • class PageLinks 79.7% similar

    A data class representing links for opening a OneNote page in different contexts (native client and web browser).

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/pages/links.py
  • class OnenotePagePreviewLinks 66.7% similar

    A data class representing preview links for a OneNote page, specifically containing a preview image URL.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/pages/preview_links.py
  • class Onenote 63.5% similar

    The Onenote class serves as the entry point for accessing Microsoft OneNote resources through the Microsoft Graph API, providing access to notebooks, pages, sections, and other OneNote entities.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/onenote.py
← Back to Browse