Skip to content

Commit 6334eb3

Browse files
committed
OneDrive: support for web parts, #866 fixes
1 parent 4e49698 commit 6334eb3

16 files changed

Lines changed: 246 additions & 20 deletions

File tree

generator/import_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ def export_to_file(path, content):
2626
"--endpoint",
2727
dest="endpoint",
2828
help="Import metadata endpoint",
29-
default="sharepoint",
29+
default="microsoftgraph",
3030
)
3131
parser.add_argument(
3232
"-p",
3333
"--path",
3434
dest="path",
35-
default="./metadata/SharePoint.xml",
35+
default="./metadata/MicrosoftGraph.xml",
3636
help="Import metadata endpoint",
3737
)
3838

generator/metadata/MicrosoftGraph.xml

Lines changed: 143 additions & 9 deletions
Large diffs are not rendered by default.

office365/onedrive/internal/paths/url.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
from typing import TYPE_CHECKING
2+
3+
from typing_extensions import Self
4+
15
from office365.onedrive.internal.paths.root import RootPath
26
from office365.runtime.paths.v4.entity import EntityPath
37

8+
if TYPE_CHECKING:
9+
from office365.runtime.paths.resource_path import ResourcePath
10+
411

512
class UrlPath(EntityPath):
613
"""Resource path for OneDrive entity path-based addressing"""
714

815
def __init__(self, url, parent, collection=None):
16+
# type: (str, ResourcePath, ResourcePath) -> None
917
"""
1018
:param str url: File or Folder server relative url
1119
:type parent: office365.runtime.paths.resource_path.ResourcePath
@@ -16,8 +24,14 @@ def __init__(self, url, parent, collection=None):
1624
parent = parent.parent
1725
elif isinstance(parent, RootPath):
1826
collection = parent.collection
27+
elif isinstance(parent, EntityPath):
28+
collection = parent.collection
1929
super(UrlPath, self).__init__(url, parent, collection)
2030

31+
def patch(self, key):
32+
# type: (str) -> Self
33+
return super(UrlPath, self).patch(key)
34+
2135
@property
2236
def segment(self):
2337
return ":/{0}:/".format(self._key)

office365/onedrive/sitepages/horizontal_section_column.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from office365.entity import Entity
22
from office365.entity_collection import EntityCollection
3-
from office365.onedrive.sitepages.web_part import WebPart
3+
from office365.onedrive.sitepages.webparts.web_part import WebPart
44
from office365.runtime.paths.resource_path import ResourcePath
55

66

office365/onedrive/sitepages/site_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from office365.onedrive.sitepages.base import BaseSitePage
55
from office365.onedrive.sitepages.canvas_layout import CanvasLayout
66
from office365.onedrive.sitepages.title_area import TitleArea
7-
from office365.onedrive.sitepages.web_part import WebPart
7+
from office365.onedrive.sitepages.webparts.web_part import WebPart
88
from office365.runtime.paths.resource_path import ResourcePath
99
from office365.runtime.queries.function import FunctionQuery
1010
from office365.runtime.queries.service_operation import ServiceOperationQuery

office365/onedrive/sitepages/vertical_section.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from office365.entity import Entity
22
from office365.entity_collection import EntityCollection
3-
from office365.onedrive.sitepages.web_part import WebPart
3+
from office365.onedrive.sitepages.webparts.web_part import WebPart
44
from office365.runtime.paths.resource_path import ResourcePath
55

66

office365/onedrive/sitepages/webparts/__init__.py

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.onedrive.sitepages.webparts.web_part import WebPart
2+
3+
4+
class StandardWebPart(WebPart):
5+
"""Represents a standard web part instance on a SharePoint page."""

0 commit comments

Comments
 (0)