Skip to content

Commit 7243f97

Browse files
committed
workbooks (#926), and sharepoint alm namespaces enhancements
1 parent dd92579 commit 7243f97

File tree

18 files changed

+246
-23
lines changed

18 files changed

+246
-23
lines changed
Binary file not shown.
Binary file not shown.

examples/sharepoint/alm/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Application Lifecycle Management (ALM) API
2+
3+
### ALM APIs provide simple APIs to manage deployment of your SharePoint Framework solutions and add-ins across your tenant.
294 KB
Binary file not shown.

office365/directory/authentication/methods/root.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from office365.directory.authentication.methods.details import UserRegistrationDetails
22
from office365.entity import Entity
33
from office365.entity_collection import EntityCollection
4+
from office365.reports.userregistration.feature_summary import (
5+
UserRegistrationFeatureSummary,
6+
)
47
from office365.reports.userregistration.method_summary import (
58
UserRegistrationMethodSummary,
69
)
@@ -12,6 +15,14 @@
1215
class AuthenticationMethodsRoot(Entity):
1316
"""Container for navigation properties for Azure AD authentication methods resources."""
1417

18+
def users_registered_by_feature(self):
19+
"""Get the number of users capable of multi-factor authentication, self-service password reset,
20+
and passwordless authentication."""
21+
return_type = ClientResult(self.context, UserRegistrationFeatureSummary())
22+
qry = FunctionQuery(self, "usersRegisteredByFeature", None, return_type)
23+
self.context.add_query(qry)
24+
return return_type
25+
1526
def users_registered_by_method(self):
1627
"""Get the number of users registered for each authentication method."""
1728
return_type = ClientResult(self.context, UserRegistrationMethodSummary())

office365/onedrive/workbooks/charts/chart.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,46 @@
11
from office365.entity import Entity
22
from office365.onedrive.workbooks.charts.axes import WorkbookChartAxes
33
from office365.onedrive.workbooks.charts.data_labels import WorkbookChartDataLabels
4+
from office365.runtime.client_result import ClientResult
45
from office365.runtime.paths.resource_path import ResourcePath
6+
from office365.runtime.queries.function import FunctionQuery
57
from office365.runtime.queries.service_operation import ServiceOperationQuery
68

79

810
class WorkbookChart(Entity):
911
"""Represents a chart object in a workbook."""
1012

11-
def set_position(self, startCell, endCell):
13+
def image(self, width=None, height=None):
14+
"""Renders the chart as a base64-encoded image by scaling the chart to fit the specified dimensions.
15+
16+
:param int width: Specifies the width of the rendered image in pixels.
17+
:param int height: Specifies the height of the rendered image in pixels.
18+
"""
19+
return_type = ClientResult(self.context)
20+
params = {"width": width, "height": height}
21+
qry = FunctionQuery(self, "image", params, return_type)
22+
self.context.add_query(qry)
23+
return return_type
24+
25+
def set_data(self, source_data, series_by):
26+
"""
27+
Updates the data source of a chart
28+
:param dict source_data:
29+
:param str series_by:
30+
"""
31+
payload = {"sourceData": source_data, "seriesBy": series_by}
32+
qry = ServiceOperationQuery(self, "setData", None, payload)
33+
self.context.add_query(qry)
34+
return self
35+
36+
def set_position(self, start_cell, end_cell):
1237
"""Positions the chart relative to cells on the worksheet.
13-
:param str startCell: The start cell. It is where the chart is moved to. The start cell is the top-left or
38+
:param str start_cell: The start cell. It is where the chart is moved to. The start cell is the top-left or
1439
top-right cell, depending on the user's right-to-left display settings.
15-
:param str endCell: The end cell. If specified, the chart's width and height is set to fully cover up
40+
:param str end_cell: The end cell. If specified, the chart's width and height is set to fully cover up
1641
this cell/range.
1742
"""
18-
payload = {"startCell": startCell, "endCell": endCell}
43+
payload = {"startCell": start_cell, "endCell": end_cell}
1944
qry = ServiceOperationQuery(self, "setPosition", None, payload)
2045
self.context.add_query(qry)
2146
return self

office365/onedrive/workbooks/ranges/range.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
class WorkbookRange(Entity):
1313
"""Range represents a set of one or more contiguous cells such as a cell, a row, a column, block of cells, etc."""
1414

15+
def __repr__(self):
16+
return self.address or self.entity_type_name
17+
18+
def __str__(self):
19+
return self.address or self.entity_type_name
20+
1521
def cell(self, row, column):
1622
"""
1723
Gets the range object containing the single cell based on row and column numbers. The cell can be outside
@@ -55,6 +61,17 @@ def visible_view(self):
5561
self.context.add_query(qry)
5662
return return_type
5763

64+
def used_range(self, values_only=False):
65+
"""Return the used range of the given range object.
66+
67+
:param bool values_only: Optional. Considers only cells with values as used cells.
68+
"""
69+
return_type = WorkbookRange(self.context)
70+
params = {"valuesOnly": values_only}
71+
qry = FunctionQuery(self, "usedRange", params, return_type)
72+
self.context.add_query(qry)
73+
return return_type
74+
5875
@property
5976
def address(self):
6077
# type: () -> Optional[str]

office365/onedrive/workbooks/worksheets/worksheet.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ def range(self, address=None):
5353
self.context.add_query(qry)
5454
return return_type
5555

56+
def used_range(self, values_only=False):
57+
"""Return the used range of the given range object.
58+
59+
:param bool values_only: Optional. Considers only cells with values as used cells.
60+
"""
61+
return_type = WorkbookRange(self.context)
62+
params = {"valuesOnly": values_only}
63+
qry = FunctionQuery(self, "usedRange", params, return_type)
64+
self.context.add_query(qry)
65+
return return_type
66+
5667
@property
5768
def charts(self):
5869
# type: () -> EntityCollection[WorkbookChart]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class UserRegistrationFeatureSummary(ClientValue):
5+
""""""

office365/sharepoint/marketplace/app_metadata.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
class CorporateCatalogAppMetadata(Entity):
88
"""App metadata for apps stored in the corporate catalog."""
99

10+
def __str__(self):
11+
return self.title or self.entity_type_name
12+
1013
def deploy(self, skip_feature_deployment):
1114
"""This method deploys an app on the app catalog. It MUST be called in the context of the tenant app
1215
catalog web or it will fail.
@@ -18,6 +21,13 @@ def deploy(self, skip_feature_deployment):
1821
self.context.add_query(qry)
1922
return self
2023

24+
def remove(self):
25+
"""This is the inverse of the add step above. One removed from the app catalog,
26+
the solution can't be deployed."""
27+
qry = ServiceOperationQuery(self, "Remove")
28+
self.context.add_query(qry)
29+
return self
30+
2131
def install(self):
2232
"""This method allows an app which is already deployed to be installed on a web."""
2333
qry = ServiceOperationQuery(self, "Install")
@@ -68,7 +78,8 @@ def id(self):
6878

6979
@property
7080
def property_ref_name(self):
71-
return "AadAppId"
81+
# return "AadAppId"
82+
return "ID"
7283

7384
@property
7485
def entity_type_name(self):

0 commit comments

Comments
 (0)