Skip to content

Commit 92fb43a

Browse files
committedDec 15, 2024·
introduced CoC, sitepages namespace types updates
1 parent 585bb3a commit 92fb43a

File tree

9 files changed

+38
-3
lines changed

9 files changed

+38
-3
lines changed
 

‎.github/CODE_OF_CONDUCT.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Treat each other well
2+
3+
Everyone participating in the _Office365-REST-Python-Client_ project, and in particular in the issue tracker,
4+
pull requests, and social media activity, is expected to treat other people with respect
5+
and more generally to follow the guidelines articulated in the
6+
[Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/).

‎office365/onedrive/driveitems/driveItem.py

+12
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class DriveItem(BaseItem):
6666
OneDrive and SharePoint are returned as driveItem resources"""
6767

6868
def get_files(self, recursive=False, page_size=None):
69+
# type: (bool, Optional[int]) -> EntityCollection["DriveItem"]
6970
"""Retrieves files
7071
:param bool recursive: Determines whether to enumerate folders recursively
7172
:param int page_size: Page size
@@ -94,6 +95,7 @@ def _after_loaded(col):
9495
return return_type
9596

9697
def get_folders(self, recursive=False, page_size=None):
98+
# type: (bool, Optional[int]) -> EntityCollection["DriveItem"]
9799
"""Retrieves folders
98100
:param bool recursive: Determines whether to enumerate folders recursively
99101
:param int page_size: Page size
@@ -177,6 +179,16 @@ def create_link(
177179
self.context.add_query(qry)
178180
return return_type
179181

182+
def discard_checkout(self):
183+
"""Discard the check out of a driveItem. This action releases a driveItem resource that was previously
184+
checked out. Any changes made to the item while it was checked out are discarded.
185+
186+
The same user that performed the checkout must discard it. Another alternative is to use application permissions
187+
"""
188+
qry = ServiceOperationQuery(self, "discardCheckout")
189+
self.context.add_query(qry)
190+
return self
191+
180192
def extract_sensitivity_labels(self):
181193
# type: () -> ClientResult[ExtractSensitivityLabelsResult]
182194
"""

‎office365/onedrive/sitepages/canvas_layout.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from office365.entity import Entity
22
from office365.entity_collection import EntityCollection
3-
from office365.onedrive.sitepages.horizontal_section import HorizontalSection
4-
from office365.onedrive.sitepages.vertical_section import VerticalSection
3+
from office365.onedrive.sitepages.sections.horizontal import HorizontalSection
4+
from office365.onedrive.sitepages.sections.vertical import VerticalSection
55
from office365.runtime.paths.resource_path import ResourcePath
66

77

‎office365/onedrive/sitepages/sections/__init__.py

Whitespace-only changes.

‎office365/onedrive/sitepages/horizontal_section.py ‎office365/onedrive/sitepages/sections/horizontal.py

+1-1
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.horizontal_section_column import (
3+
from office365.onedrive.sitepages.sections.horizontal_column import (
44
HorizontalSectionColumn,
55
)
66
from office365.runtime.paths.resource_path import ResourcePath
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class WebPartPosition(ClientValue):
5+
"""Represents the position information of the given web part to the current page"""
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
from office365.entity import Entity
2+
from office365.onedrive.sitepages.webparts.position import WebPartPosition
3+
from office365.runtime.client_result import ClientResult
4+
from office365.runtime.queries.service_operation import ServiceOperationQuery
25

36

47
class WebPart(Entity):
58
"""Represents a specific web part instance on a SharePoint page."""
9+
10+
def get_position_of_web_part(self):
11+
"""Returns the position of the specified web part in the page."""
12+
return_type = ClientResult(self.context, WebPartPosition())
13+
qry = ServiceOperationQuery(
14+
self, "getPositionOfWebPart", return_type=return_type
15+
)
16+
self.context.add_query(qry)
17+
return self

0 commit comments

Comments
 (0)
Please sign in to comment.