class OnenotePage
A page in a OneNote notebook.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/pages/page.py
13 - 78
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: Parameterdefault_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)
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class OnenoteSection 79.2% similar
-
class OnenotePageCollection 73.5% similar
-
class Onenote 67.7% similar
-
class Notebook 63.0% similar
-
class PageLinks 62.3% similar