-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates for workbooks namespace in OneDrive API
- Loading branch information
Showing
29 changed files
with
341 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Enumerates files along with role assignments | ||
""" | ||
|
||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.listitems.listitem import ListItem | ||
from office365.sharepoint.principal.type import PrincipalType | ||
from tests import test_client_credentials, test_team_site_url | ||
|
||
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials) | ||
doc_lib = ctx.web.default_document_library() | ||
# retrieve all the files from a library | ||
items = ( | ||
doc_lib.items.select(["FSObjType", "EncodedAbsUrl", "Id"]) | ||
.filter("FSObjType eq 0") | ||
.get_all() | ||
.execute_query() | ||
) | ||
|
||
# per every list item (file facet) retrieve role assignments (where role assignment is associated with a principal, | ||
# which could be a user or a group) | ||
for item in items: # type: ListItem | ||
role_assignments = item.role_assignments.expand(["Member"]).get().execute_query() | ||
print("File: {0}".format(item.properties["EncodedAbsUrl"])) | ||
for ra in role_assignments: | ||
if ra.member.principal_type == PrincipalType.SharePointGroup: | ||
print(ra.member) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
office365/directory/identitygovernance/privilegedaccess/approval.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class Approval(Entity): | ||
"""Represents the approval object for decisions associated with a request. | ||
In PIM for groups, the approval object for decisions to approve or deny requests to activate | ||
group membership or ownership.""" |
30 changes: 30 additions & 0 deletions
30
office365/directory/identitygovernance/privilegedaccess/group.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,35 @@ | ||
from office365.directory.identitygovernance.privilegedaccess.approval import Approval | ||
from office365.directory.identitygovernance.privilegedaccess.group_assignment_schedule_instance import ( | ||
PrivilegedAccessGroupAssignmentScheduleInstance, | ||
) | ||
from office365.entity import Entity | ||
from office365.entity_collection import EntityCollection | ||
from office365.runtime.paths.resource_path import ResourcePath | ||
|
||
|
||
class PrivilegedAccessGroup(Entity): | ||
"""The entry point for all resources related to Privileged Identity Management (PIM) for groups.""" | ||
|
||
@property | ||
def assignment_approvals(self): | ||
""" """ | ||
return self.properties.get( | ||
"assignmentApprovals", | ||
EntityCollection( | ||
self.context, | ||
Approval, | ||
ResourcePath("assignmentApprovals", self.resource_path), | ||
), | ||
) | ||
|
||
@property | ||
def assignment_schedule_instances(self): | ||
"""The instances of assignment schedules to activate a just-in-time access.""" | ||
return self.properties.get( | ||
"assignmentScheduleInstances", | ||
EntityCollection( | ||
self.context, | ||
PrivilegedAccessGroupAssignmentScheduleInstance, | ||
ResourcePath("assignmentScheduleInstances", self.resource_path), | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class WebPartData(ClientValue): | ||
"""""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
from typing import Optional | ||
|
||
from office365.onedrive.sitepages.webparts.data import WebPartData | ||
from office365.onedrive.sitepages.webparts.web_part import WebPart | ||
|
||
|
||
class StandardWebPart(WebPart): | ||
"""Represents a standard web part instance on a SharePoint page.""" | ||
|
||
@property | ||
def data(self): | ||
# type: () -> Optional[WebPartData] | ||
"""Data of the webPart.""" | ||
return self.properties.get("data", WebPartData()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,3 @@ | |
|
||
class WorkbookChartLegend(Entity): | ||
"""Represents the legend in a chart.""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class WorkbookChartPoint(Entity): | ||
"""Represents a point of a series in a chart.""" |
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class WorkbookChartSeriesFormat(Entity): | ||
"""Encapsulates the format properties for the chart series""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from office365.entity import Entity | ||
from office365.entity_collection import EntityCollection | ||
from office365.onedrive.workbooks.charts.point import WorkbookChartPoint | ||
from office365.onedrive.workbooks.charts.series.format import WorkbookChartSeriesFormat | ||
from office365.runtime.paths.resource_path import ResourcePath | ||
|
||
|
||
class WorkbookChartSeries(Entity): | ||
"""Represents a series in a chart.""" | ||
|
||
@property | ||
def format(self): | ||
"""The formatting of a chart series, which includes fill and line formatting.""" | ||
return self.properties.get( | ||
"format", | ||
WorkbookChartSeriesFormat( | ||
self.context, ResourcePath("format", self.resource_path) | ||
), | ||
) | ||
|
||
@property | ||
def points(self): | ||
"""A collection of all points in the series.""" | ||
return self.properties.get( | ||
"points", | ||
EntityCollection( | ||
self.context, | ||
WorkbookChartPoint, | ||
ResourcePath("points", self.resource_path), | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class WorkbookChartTitle(Entity): | ||
"""Represents a chart title object of a chart.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
from typing import Optional | ||
|
||
from office365.entity import Entity | ||
|
||
|
||
class WorkbookRangeFill(Entity): | ||
"""Represents the background of a range object.""" | ||
"""HTML color code representing the color of the border line. Can either be of the form #RRGGBB, | ||
for example "FFA500", or be a named HTML color, for example "orange".""" | ||
|
||
@property | ||
def color(self): | ||
# type: () -> Optional[str] | ||
"""Gets or sets the width of all columns within the range. If the column widths aren't uniform, | ||
null will be returned.""" | ||
return self.properties.get("color", None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
from office365.entity import Entity | ||
from office365.onedrive.workbooks.sort_field import WorkbookSortField | ||
from office365.runtime.client_value_collection import ClientValueCollection | ||
from office365.runtime.queries.service_operation import ServiceOperationQuery | ||
|
||
|
||
class WorkbookTableSort(Entity): | ||
"""Manages sorting operations on Table objects.""" | ||
|
||
def apply(self, fields, match_case=None, method=None): | ||
"""Perform a sort operation. | ||
:param list[WorkbookSortField] fields: The list of conditions to sort on. | ||
:param bool match_case: Indicates whether to match the case of the items being sorted. | ||
:param str method: The ordering method used for Chinese characters. | ||
The possible values are: PinYin, StrokeCount. | ||
""" | ||
payload = { | ||
"fields": ClientValueCollection(WorkbookSortField, fields), | ||
"matchCase": match_case, | ||
"method": method, | ||
} | ||
qry = ServiceOperationQuery(self, "apply", None, payload) | ||
self.context.add_query(qry) | ||
return self |
Oops, something went wrong.