🔍 Code Extractor

class OnenotePage

Maturity: 32

A page in a OneNote notebook.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/pages/page.py
Lines:
13 - 78
Complexity:
moderate

Purpose

A page in a OneNote notebook.

Source Code

class OnenotePage(OnenoteEntitySchemaObjectModel):
    """A page in a OneNote notebook."""

    def get_content(self):
        # type: () -> ClientResult[AnyStr]
        """Download the page's HTML content."""
        return_type = ClientResult(self.context)
        qry = FunctionQuery(self, "content", None, return_type)
        self.context.add_query(qry)
        return return_type

    @property
    def content_url(self):
        # type: () -> Optional[str]
        """The URL for the page's HTML content. Read-only."""
        return self.properties.get("contentUrl", None)

    @property
    def links(self):
        """Links for opening the page. The oneNoteClientURL link opens the page in the OneNote native client
        if it 's installed. The oneNoteWebUrl link opens the page in OneNote on the web. Read-only.

        """
        return self.properties.get("links", PageLinks())

    @property
    def title(self):
        # type: () -> Optional[str]
        """The title of the page."""
        return self.properties.get("title", None)

    @property
    def user_tags(self):
        """Links for opening the page. The oneNoteClientURL link opens the page in the OneNote native client
        if it 's installed. The oneNoteWebUrl link opens the page in OneNote on the web. Read-only.

        """
        return self.properties.get("userTags", StringCollection())

    @property
    def parent_notebook(self):
        """The notebook that contains the page. Read-only."""
        return self.properties.get(
            "parentNotebook",
            Notebook(self.context, ResourcePath("parentNotebook", self.resource_path)),
        )

    @property
    def parent_section(self):
        """The section that contains the page."""
        return self.properties.get(
            "parentSection",
            OnenoteSection(
                self.context, ResourcePath("parentSection", self.resource_path)
            ),
        )

    def get_property(self, name, default_value=None):
        if default_value is None:
            property_mapping = {
                "userTags": self.user_tags,
                "parentSection": self.parent_section,
                "parentNotebook": self.parent_notebook,
            }
            default_value = property_mapping.get(name, None)
        return super(OnenotePage, self).get_property(name, default_value)

Parameters

Name Type Default Kind
bases OnenoteEntitySchemaObjectModel -

Parameter Details

bases: Parameter of type OnenoteEntitySchemaObjectModel

Return Value

Returns unspecified type

Class Interface

Methods

get_content(self)

Purpose: Download the page's HTML content.

Returns: None

content_url(self) property

Purpose: The URL for the page's HTML content. Read-only.

Returns: None

links(self) property

Purpose: Links for opening the page. The oneNoteClientURL link opens the page in the OneNote native client if it 's installed. The oneNoteWebUrl link opens the page in OneNote on the web. Read-only.

Returns: None

title(self) property

Purpose: The title of the page.

Returns: None

user_tags(self) property

Purpose: Links for opening the page. The oneNoteClientURL link opens the page in the OneNote native client if it 's installed. The oneNoteWebUrl link opens the page in OneNote on the web. Read-only.

Returns: None

parent_notebook(self) property

Purpose: The notebook that contains the page. Read-only.

Returns: None

parent_section(self) property

Purpose: The section that contains the page.

Returns: None

get_property(self, name, default_value)

Purpose: Retrieves property

Parameters:

  • name: Parameter
  • default_value: Parameter

Returns: None

Required Imports

from typing import AnyStr
from typing import Optional
from office365.onenote.entity_schema_object_model import OnenoteEntitySchemaObjectModel
from office365.onenote.notebooks.notebook import Notebook
from office365.onenote.pages.links import PageLinks

Usage Example

# Example usage:
# result = OnenotePage(bases)

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class OnenoteSection 79.2% similar

    A section in a OneNote notebook. Sections can contain pages.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/sections/section.py
  • class OnenotePageCollection 73.5% similar

    A collection class for managing OneNote pages within a OneNote notebook, providing methods to create and manage multiple OnenotePage instances.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/pages/collection.py
  • class Onenote 67.7% 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
  • class Notebook 63.0% similar

    Represents a OneNote notebook entity with access to its sections and section groups, providing a hierarchical structure for organizing OneNote content.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/notebooks/notebook.py
  • class PageLinks 62.3% 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
← Back to Browse