Office365-REST-Python-Client 2.5.4__py3-none-any.whl → 2.5.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/METADATA +2 -2
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/RECORD +224 -204
- office365/booking/business/business.py +5 -3
- office365/booking/virtualevents/__init__.py +0 -0
- office365/booking/virtualevents/root.py +5 -0
- office365/communications/calls/participant.py +4 -5
- office365/directory/applications/application.py +3 -3
- office365/directory/applications/roles/assignment_collection.py +1 -1
- office365/directory/applications/roles/collection.py +2 -2
- office365/directory/authentication/method_configuration.py +9 -0
- office365/directory/authentication/method_mode_detail.py +8 -0
- office365/directory/authentication/method_target.py +5 -0
- office365/directory/authentication/strength_root.py +5 -0
- office365/directory/certificates/auth_configuration.py +1 -3
- office365/directory/extensions/extended_property.py +4 -4
- office365/directory/extensions/open_type.py +4 -4
- office365/directory/groups/group.py +2 -6
- office365/directory/identities/conditional_access_root.py +10 -1
- office365/directory/identities/container.py +3 -9
- office365/directory/identities/providers/base.py +7 -5
- office365/directory/identities/providers/builtin_identity.py +3 -2
- office365/directory/identities/providers/saml_or_wsfed.py +4 -5
- office365/directory/identities/providers/social_identity.py +5 -3
- office365/directory/identities/userflows/b2x/user_flow.py +6 -5
- office365/directory/identities/userflows/language_configuration.py +10 -7
- office365/directory/identitygovernance/governance.py +14 -3
- office365/directory/identitygovernance/privilegedaccess/__init__.py +0 -0
- office365/directory/identitygovernance/privilegedaccess/root.py +5 -0
- office365/directory/key_credential.py +3 -0
- office365/directory/licenses/assignment_state.py +26 -2
- office365/directory/licenses/details.py +8 -6
- office365/directory/licenses/subscribed_sku.py +8 -10
- office365/directory/object_collection.py +40 -25
- office365/directory/password_credential.py +3 -0
- office365/directory/permissions/default_user_role.py +5 -0
- office365/directory/permissions/grants/condition_set.py +4 -2
- office365/directory/permissions/grants/oauth2.py +7 -10
- office365/directory/policies/authorization.py +50 -3
- office365/directory/policies/permission_grant.py +2 -0
- office365/directory/profile_photo.py +6 -6
- office365/directory/protection/riskyusers/risky_user.py +4 -4
- office365/directory/rolemanagement/resource_action.py +10 -0
- office365/directory/rolemanagement/role_permission.py +10 -0
- office365/directory/security/alerts/alert.py +5 -7
- office365/directory/security/attacksimulations/landing_page.py +5 -0
- office365/directory/security/attacksimulations/operation.py +5 -0
- office365/directory/security/attacksimulations/report.py +8 -1
- office365/directory/security/attacksimulations/root.py +33 -0
- office365/directory/security/attacksimulations/users/__init__.py +0 -0
- office365/directory/security/attacksimulations/users/details.py +5 -0
- office365/directory/security/hunting_query_results.py +5 -0
- office365/directory/security/incidents/incident.py +8 -13
- office365/directory/security/security.py +20 -3
- office365/directory/serviceprincipals/service_principal.py +3 -4
- office365/directory/synchronization/synchronization.py +2 -0
- office365/directory/users/activities/history_item.py +3 -2
- office365/directory/users/user.py +37 -10
- office365/entity_collection.py +3 -2
- office365/graph_client.py +58 -30
- office365/intune/audit/event.py +1 -3
- office365/intune/audit/event_collection.py +1 -1
- office365/intune/devices/alternative_security_id.py +4 -0
- office365/intune/devices/collection.py +57 -0
- office365/intune/devices/device.py +38 -10
- office365/intune/devices/management/management.py +12 -0
- office365/intune/organizations/organization.py +1 -0
- office365/onedrive/analytics/item_activity_stat.py +9 -0
- office365/onedrive/analytics/item_analytics.py +1 -0
- office365/onedrive/contenttypes/content_type.py +4 -12
- office365/onedrive/driveitems/driveItem.py +9 -10
- office365/onedrive/files/hashes.py +5 -0
- office365/onedrive/lists/collection.py +2 -2
- office365/onedrive/operations/long_running.py +6 -6
- office365/onedrive/operations/rich_long_running.py +4 -3
- office365/onedrive/permissions/collection.py +1 -14
- office365/onedrive/sharepoint_settings.py +6 -6
- office365/onedrive/sites/sites_with_root.py +1 -3
- office365/onedrive/termstore/store.py +2 -4
- office365/onedrive/termstore/terms/collection.py +1 -2
- office365/onedrive/workbooks/comments/comment.py +7 -6
- office365/onedrive/workbooks/filter.py +9 -0
- office365/onedrive/workbooks/filter_criteria.py +5 -0
- office365/onedrive/workbooks/functions/functions.py +6 -3
- office365/onedrive/workbooks/functions/result.py +2 -0
- office365/onedrive/workbooks/operations/workbook.py +7 -10
- office365/onedrive/workbooks/tables/pivot_table.py +9 -9
- office365/onedrive/workbooks/worksheets/collection.py +0 -6
- office365/onedrive/workbooks/worksheets/protection.py +2 -0
- office365/onedrive/workbooks/worksheets/worksheet.py +30 -2
- office365/onenote/notebooks/collection.py +0 -1
- office365/outlook/calendar/events/event.py +24 -46
- office365/outlook/calendar/permissions/permission.py +7 -7
- office365/outlook/calendar/place.py +5 -3
- office365/outlook/mail/attachments/collection.py +6 -1
- office365/outlook/mail/attachments/file.py +9 -16
- office365/outlook/mail/messages/message.py +1 -1
- office365/planner/user.py +3 -7
- office365/reports/root.py +50 -4
- office365/runtime/auth/providers/acs_token_provider.py +10 -7
- office365/runtime/auth/sts_profile.py +0 -1
- office365/runtime/client_object.py +21 -17
- office365/runtime/client_object_collection.py +9 -24
- office365/runtime/client_request_exception.py +1 -3
- office365/runtime/client_result.py +11 -14
- office365/runtime/client_runtime_context.py +20 -32
- office365/runtime/odata/json_format.py +4 -7
- office365/runtime/odata/request.py +3 -3
- office365/runtime/odata/v3/batch_request.py +17 -31
- office365/runtime/odata/v4/batch_request.py +13 -21
- office365/runtime/queries/batch.py +5 -11
- office365/runtime/queries/function.py +5 -6
- office365/runtime/types/event_handler.py +1 -1
- office365/search/entity.py +3 -2
- office365/sharepoint/activities/facets/delete.py +1 -1
- office365/sharepoint/activities/tracked_item_service.py +2 -3
- office365/sharepoint/administration/web_application.py +8 -7
- office365/sharepoint/alerts/alert.py +8 -12
- office365/sharepoint/audit/audit.py +3 -2
- office365/sharepoint/changes/alert.py +4 -3
- office365/sharepoint/changes/collection.py +7 -10
- office365/sharepoint/changes/content_type.py +4 -4
- office365/sharepoint/changes/field.py +4 -5
- office365/sharepoint/changes/item.py +34 -7
- office365/sharepoint/changes/list.py +4 -4
- office365/sharepoint/changes/user.py +5 -6
- office365/sharepoint/client_context.py +20 -20
- office365/sharepoint/clientsidecomponent/component_context_info.py +4 -3
- office365/sharepoint/contentcenter/machinelearning/enabled.py +4 -3
- office365/sharepoint/contentcenter/machinelearning/hub.py +6 -6
- office365/sharepoint/contentcenter/machinelearning/models/collection.py +1 -1
- office365/sharepoint/contenttypes/fieldlinks/collection.py +4 -6
- office365/sharepoint/contenttypes/fieldlinks/field_link.py +14 -22
- office365/sharepoint/entity.py +12 -5
- office365/sharepoint/entity_collection.py +1 -3
- office365/sharepoint/eventreceivers/definition.py +8 -12
- office365/sharepoint/features/collection.py +3 -6
- office365/sharepoint/features/definitions/definition.py +6 -3
- office365/sharepoint/fields/calculated.py +8 -14
- office365/sharepoint/fields/collection.py +42 -10
- office365/sharepoint/fields/computed.py +4 -5
- office365/sharepoint/fields/currency.py +7 -11
- office365/sharepoint/fields/date_time.py +4 -8
- office365/sharepoint/fields/field.py +6 -16
- office365/sharepoint/fields/lookup.py +11 -9
- office365/sharepoint/fields/multi_choice.py +8 -12
- office365/sharepoint/fields/multi_line_text.py +10 -14
- office365/sharepoint/fields/number.py +13 -26
- office365/sharepoint/fields/rating_scale.py +6 -10
- office365/sharepoint/fields/related_field.py +10 -17
- office365/sharepoint/fields/url.py +4 -5
- office365/sharepoint/fields/user.py +10 -9
- office365/sharepoint/files/checked_out_file.py +4 -3
- office365/sharepoint/files/collection.py +17 -15
- office365/sharepoint/files/file.py +33 -27
- office365/sharepoint/folders/collection.py +22 -5
- office365/sharepoint/folders/coloring.py +11 -9
- office365/sharepoint/folders/coloring_information.py +38 -0
- office365/sharepoint/folders/folder.py +26 -30
- office365/sharepoint/likes/liked_by_information.py +7 -10
- office365/sharepoint/likes/user_entity.py +6 -8
- office365/sharepoint/listitems/form_update_value.py +17 -1
- office365/sharepoint/listitems/listitem.py +9 -11
- office365/sharepoint/lists/bloom_filter.py +5 -7
- office365/sharepoint/lists/creatables_info.py +5 -6
- office365/sharepoint/lists/list.py +25 -10
- office365/sharepoint/lists/template.py +7 -4
- office365/sharepoint/lists/template_collection.py +2 -4
- office365/sharepoint/marketplace/app_metadata.py +14 -23
- office365/sharepoint/marketplace/sitecollection/appcatalog/allowed_item.py +6 -8
- office365/sharepoint/navigation/node.py +5 -8
- office365/sharepoint/permissions/irm/effective_settings.py +6 -8
- office365/sharepoint/permissions/irm/file_settings.py +8 -6
- office365/sharepoint/permissions/irm/settings.py +25 -43
- office365/sharepoint/portal/groups/site_manager.py +6 -7
- office365/sharepoint/portal/sites/manager.py +4 -3
- office365/sharepoint/publishing/embed_data_v1.py +8 -15
- office365/sharepoint/publishing/pages/campaign_publication.py +4 -3
- office365/sharepoint/publishing/primary_city_time.py +8 -9
- office365/sharepoint/publishing/video/service_discoverer.py +4 -3
- office365/sharepoint/pushnotifications/subscriber.py +11 -15
- office365/sharepoint/sharing/object_sharing_settings.py +24 -46
- office365/sharepoint/sharing/permission_information.py +5 -5
- office365/sharepoint/sharing/result.py +1 -0
- office365/sharepoint/sitedesigns/run.py +4 -3
- office365/sharepoint/sites/site.py +7 -16
- office365/sharepoint/taxonomy/field.py +32 -21
- office365/sharepoint/taxonomy/groups/group.py +12 -1
- office365/sharepoint/taxonomy/sets/set.py +6 -0
- office365/sharepoint/taxonomy/stores/store.py +4 -2
- office365/sharepoint/teams/channel.py +6 -6
- office365/sharepoint/tenant/administration/endpoints.py +4 -3
- office365/sharepoint/tenant/administration/hubsites/properties.py +4 -5
- office365/sharepoint/tenant/administration/sites/properties.py +0 -1
- office365/sharepoint/tenant/administration/spo_operation.py +4 -4
- office365/sharepoint/tenant/administration/tenant.py +1 -0
- office365/sharepoint/tenant/insights/report.py +11 -0
- office365/sharepoint/tenant/insights/report_manager.py +5 -0
- office365/sharepoint/tenant/insights/report_metadata.py +5 -0
- office365/sharepoint/tenant/settings.py +4 -3
- office365/sharepoint/translation/sync_translator.py +3 -2
- office365/sharepoint/ui/applicationpages/peoplepicker/entity_information.py +4 -4
- office365/sharepoint/usercustomactions/action.py +12 -20
- office365/sharepoint/userprofiles/followed_content.py +6 -10
- office365/sharepoint/userprofiles/people_manager.py +0 -1
- office365/sharepoint/userprofiles/person_properties.py +14 -30
- office365/sharepoint/userprofiles/personal_cache.py +4 -3
- office365/sharepoint/userprofiles/properties_for_user.py +4 -5
- office365/sharepoint/userprofiles/sharedwithme/document.py +12 -21
- office365/sharepoint/utilities/move_copy_util.py +19 -19
- office365/sharepoint/utilities/upload_status.py +7 -10
- office365/sharepoint/views/field_collection.py +9 -14
- office365/sharepoint/views/view.py +43 -64
- office365/sharepoint/webhooks/subscription.py +11 -19
- office365/sharepoint/webparts/webpart.py +3 -1
- office365/sharepoint/webs/modernize_homepage_result.py +4 -3
- office365/sharepoint/webs/regional_settings.py +9 -17
- office365/sharepoint/webs/template.py +18 -18
- office365/sharepoint/webs/theme_info.py +6 -6
- office365/sharepoint/webs/web.py +16 -23
- office365/teams/members/aad_user_conversation.py +4 -4
- office365/teams/operations/async_operation.py +5 -7
- office365/runtime/paths/item.py +0 -8
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.entity import Entity
|
|
2
4
|
from office365.outlook.mail.physical_address import PhysicalAddress
|
|
3
5
|
|
|
@@ -8,9 +10,8 @@ class Place(Entity):
|
|
|
8
10
|
|
|
9
11
|
@property
|
|
10
12
|
def display_name(self):
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"""
|
|
13
|
+
# type: () -> Optional[str]
|
|
14
|
+
"""The name associated with the place."""
|
|
14
15
|
return self.properties.get("displayName", None)
|
|
15
16
|
|
|
16
17
|
@property
|
|
@@ -20,5 +21,6 @@ class Place(Entity):
|
|
|
20
21
|
|
|
21
22
|
@property
|
|
22
23
|
def phone(self):
|
|
24
|
+
# type: () -> Optional[str]
|
|
23
25
|
"""The phone number of the place."""
|
|
24
26
|
return self.properties.get("phone", None)
|
|
@@ -4,7 +4,10 @@ import requests
|
|
|
4
4
|
|
|
5
5
|
from office365.entity_collection import EntityCollection
|
|
6
6
|
from office365.outlook.mail.attachments.attachment import Attachment
|
|
7
|
+
from office365.runtime.client_result import ClientResult
|
|
7
8
|
from office365.runtime.compat import parse_query_string
|
|
9
|
+
from office365.runtime.http.request_options import RequestOptions
|
|
10
|
+
from office365.runtime.odata.v4.upload_session import UploadSession
|
|
8
11
|
from office365.runtime.odata.v4.upload_session_request import UploadSessionRequest
|
|
9
12
|
from office365.runtime.queries.upload_session import UploadSessionQuery
|
|
10
13
|
|
|
@@ -60,13 +63,15 @@ class AttachmentCollection(EntityCollection[Attachment]):
|
|
|
60
63
|
self, {"AttachmentItem": AttachmentItem.create_file(source_path)}
|
|
61
64
|
)
|
|
62
65
|
|
|
63
|
-
def _start_upload():
|
|
66
|
+
def _start_upload(result):
|
|
67
|
+
# type: (ClientResult[UploadSession]) -> None
|
|
64
68
|
with open(source_path, "rb") as local_file:
|
|
65
69
|
session_request = UploadSessionRequest(
|
|
66
70
|
local_file, chunk_size, chunk_uploaded
|
|
67
71
|
)
|
|
68
72
|
|
|
69
73
|
def _construct_request(request):
|
|
74
|
+
# type: (RequestOptions) -> None
|
|
70
75
|
auth_token = parse_query_string(request.url, "authtoken")
|
|
71
76
|
request.set_header("Authorization", "Bearer {0}".format(auth_token))
|
|
72
77
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import AnyStr, Optional
|
|
2
|
+
|
|
1
3
|
from office365.outlook.mail.attachments.attachment import Attachment
|
|
2
4
|
|
|
3
5
|
|
|
@@ -6,32 +8,23 @@ class FileAttachment(Attachment):
|
|
|
6
8
|
|
|
7
9
|
@property
|
|
8
10
|
def content_id(self):
|
|
9
|
-
|
|
10
|
-
The ID of the attachment in the Exchange store.
|
|
11
|
-
|
|
12
|
-
:rtype: str or None
|
|
13
|
-
"""
|
|
11
|
+
# type: () -> Optional[str]
|
|
12
|
+
"""The ID of the attachment in the Exchange store."""
|
|
14
13
|
return self.properties.get("contentId", None)
|
|
15
14
|
|
|
16
15
|
@property
|
|
17
16
|
def content_location(self):
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"""
|
|
17
|
+
# type: () -> Optional[str]
|
|
18
|
+
""" """
|
|
21
19
|
return self.properties.get("content_location", None)
|
|
22
20
|
|
|
23
21
|
@property
|
|
24
22
|
def content_bytes(self):
|
|
25
|
-
|
|
26
|
-
The base64-encoded contents of the file.
|
|
27
|
-
|
|
28
|
-
:rtype: str or None
|
|
29
|
-
"""
|
|
23
|
+
# type: () -> Optional[AnyStr]
|
|
24
|
+
"""The base64-encoded contents of the file."""
|
|
30
25
|
return self.properties.get("contentBytes", None)
|
|
31
26
|
|
|
32
27
|
@content_bytes.setter
|
|
33
28
|
def content_bytes(self, value):
|
|
34
|
-
"""
|
|
35
|
-
Sets the base64-encoded contents of the file.
|
|
36
|
-
"""
|
|
29
|
+
"""Sets the base64-encoded contents of the file."""
|
|
37
30
|
self.set_property("contentBytes", value)
|
|
@@ -103,7 +103,7 @@ class Message(OutlookItem):
|
|
|
103
103
|
if a file that's smaller than 3 MB, then add_file_attachment method is utilized
|
|
104
104
|
|
|
105
105
|
:param str file_path:
|
|
106
|
-
:param ()->None chunk_uploaded: Upload action
|
|
106
|
+
:param (int)->None chunk_uploaded: Upload action
|
|
107
107
|
"""
|
|
108
108
|
max_upload_chunk = 1000000 * 3
|
|
109
109
|
file_size = os.stat(file_path).st_size
|
office365/planner/user.py
CHANGED
|
@@ -10,9 +10,7 @@ class PlannerUser(Entity):
|
|
|
10
10
|
|
|
11
11
|
@property
|
|
12
12
|
def plans(self):
|
|
13
|
-
"""
|
|
14
|
-
Returns the plannerTasks assigned to the user.
|
|
15
|
-
"""
|
|
13
|
+
"""Returns the plannerTasks assigned to the user."""
|
|
16
14
|
from office365.planner.plans.collection import PlannerPlanCollection
|
|
17
15
|
|
|
18
16
|
return self.properties.get(
|
|
@@ -24,10 +22,8 @@ class PlannerUser(Entity):
|
|
|
24
22
|
|
|
25
23
|
@property
|
|
26
24
|
def tasks(self):
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
:rtype: EntityCollection
|
|
30
|
-
"""
|
|
25
|
+
# type: () -> EntityCollection[PlannerTask]
|
|
26
|
+
"""Returns the plannerTasks assigned to the user."""
|
|
31
27
|
return self.properties.get(
|
|
32
28
|
"tasks",
|
|
33
29
|
EntityCollection(
|
office365/reports/root.py
CHANGED
|
@@ -72,6 +72,18 @@ class ReportRoot(Entity):
|
|
|
72
72
|
self.context.add_query(qry)
|
|
73
73
|
return qry.return_type
|
|
74
74
|
|
|
75
|
+
def get_email_app_usage_apps_user_counts(self, period):
|
|
76
|
+
"""
|
|
77
|
+
Get the count of unique users per email app.
|
|
78
|
+
|
|
79
|
+
:param str period: Specifies the length of time over which the report is aggregated.
|
|
80
|
+
The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
|
|
81
|
+
Dn where n represents the number of days over which the report is aggregated. Required.
|
|
82
|
+
"""
|
|
83
|
+
qry = create_report_query(self, "getEmailAppUsageAppsUserCounts", period)
|
|
84
|
+
self.context.add_query(qry)
|
|
85
|
+
return qry.return_type
|
|
86
|
+
|
|
75
87
|
def get_m365_app_user_counts(self, period=None):
|
|
76
88
|
"""
|
|
77
89
|
Get a report that provides the trend in the number of active users for each app (Outlook, Word, Excel,
|
|
@@ -85,10 +97,7 @@ class ReportRoot(Entity):
|
|
|
85
97
|
return return_type
|
|
86
98
|
|
|
87
99
|
def get_office365_activations_user_counts(self):
|
|
88
|
-
"""
|
|
89
|
-
Get the count of Microsoft 365 activations on desktops and devices.
|
|
90
|
-
|
|
91
|
-
"""
|
|
100
|
+
"""Get the count of Microsoft 365 activations on desktops and devices."""
|
|
92
101
|
qry = create_report_query(self, "getOffice365ActivationsUserCounts")
|
|
93
102
|
self.context.add_query(qry)
|
|
94
103
|
return qry.return_type
|
|
@@ -166,6 +175,19 @@ class ReportRoot(Entity):
|
|
|
166
175
|
self.context.add_query(qry)
|
|
167
176
|
return qry.return_type
|
|
168
177
|
|
|
178
|
+
def get_mailbox_usage_mailbox_counts(self, period):
|
|
179
|
+
"""
|
|
180
|
+
Get the total number of user mailboxes in your organization and how many are active each day of the reporting
|
|
181
|
+
period. A mailbox is considered active if the user sent or read any email.
|
|
182
|
+
|
|
183
|
+
:param str period: Specifies the length of time over which the report is aggregated.
|
|
184
|
+
The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
|
|
185
|
+
Dn where n represents the number of days over which the report is aggregated. Required.
|
|
186
|
+
"""
|
|
187
|
+
qry = create_report_query(self, "getMailboxUsageMailboxCounts", period)
|
|
188
|
+
self.context.add_query(qry)
|
|
189
|
+
return qry.return_type
|
|
190
|
+
|
|
169
191
|
def get_sharepoint_activity_pages(self, period):
|
|
170
192
|
"""
|
|
171
193
|
Get the number of unique pages visited by users.
|
|
@@ -203,6 +225,30 @@ class ReportRoot(Entity):
|
|
|
203
225
|
self.context.add_query(qry)
|
|
204
226
|
return qry.return_type
|
|
205
227
|
|
|
228
|
+
def get_sharepoint_site_usage_detail(self, period):
|
|
229
|
+
"""
|
|
230
|
+
Get details about SharePoint site usage.
|
|
231
|
+
|
|
232
|
+
:param str period: Specifies the length of time over which the report is aggregated.
|
|
233
|
+
The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
|
|
234
|
+
Dn where n represents the number of days over which the report is aggregated. Required.
|
|
235
|
+
"""
|
|
236
|
+
qry = create_report_query(self, "getSharePointSiteUsageDetail", period)
|
|
237
|
+
self.context.add_query(qry)
|
|
238
|
+
return qry.return_type
|
|
239
|
+
|
|
240
|
+
def get_sharepoint_site_usage_site_counts(self, period):
|
|
241
|
+
"""
|
|
242
|
+
Get the trend of total and active site count during the reporting period.
|
|
243
|
+
|
|
244
|
+
:param str period: Specifies the length of time over which the report is aggregated.
|
|
245
|
+
The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
|
|
246
|
+
Dn where n represents the number of days over which the report is aggregated. Required.
|
|
247
|
+
"""
|
|
248
|
+
qry = create_report_query(self, "getSharePointSiteUsageSiteCounts", period)
|
|
249
|
+
self.context.add_query(qry)
|
|
250
|
+
return qry.return_type
|
|
251
|
+
|
|
206
252
|
@property
|
|
207
253
|
def authentication_methods(self):
|
|
208
254
|
"""Container for navigation properties for Azure AD authentication methods resources."""
|
|
@@ -10,7 +10,7 @@ from office365.runtime.http.request_options import RequestOptions
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class ACSTokenProvider(AuthenticationProvider, office365.logger.LoggerContext):
|
|
13
|
-
def __init__(self, url, client_id, client_secret, environment=
|
|
13
|
+
def __init__(self, url, client_id, client_secret, environment="commercial"):
|
|
14
14
|
"""
|
|
15
15
|
Provider to acquire the access token from a Microsoft Azure Access Control Service (ACS)
|
|
16
16
|
|
|
@@ -65,7 +65,9 @@ class ACSTokenProvider(AuthenticationProvider, office365.logger.LoggerContext):
|
|
|
65
65
|
self.SharePointPrincipal, target_host, target_realm
|
|
66
66
|
)
|
|
67
67
|
principal_id = self.get_formatted_principal(self._client_id, None, target_realm)
|
|
68
|
-
sts_url = self.get_security_token_service_url(
|
|
68
|
+
sts_url = self.get_security_token_service_url(
|
|
69
|
+
target_realm, environment=self._environment
|
|
70
|
+
)
|
|
69
71
|
oauth2_request = {
|
|
70
72
|
"grant_type": "client_credentials",
|
|
71
73
|
"client_id": principal_id,
|
|
@@ -105,13 +107,14 @@ class ACSTokenProvider(AuthenticationProvider, office365.logger.LoggerContext):
|
|
|
105
107
|
|
|
106
108
|
@staticmethod
|
|
107
109
|
def get_security_token_service_url(realm, environment):
|
|
110
|
+
# type: (str, str) -> str
|
|
108
111
|
if environment == "GCCH":
|
|
109
|
-
return "https://login.microsoftonline.us/{0}/tokens/OAuth/2".format(
|
|
110
|
-
realm
|
|
111
|
-
)
|
|
112
|
+
return "https://login.microsoftonline.us/{0}/tokens/OAuth/2".format(realm)
|
|
112
113
|
else:
|
|
113
|
-
return
|
|
114
|
-
|
|
114
|
+
return (
|
|
115
|
+
"https://accounts.accesscontrol.windows.net/{0}/tokens/OAuth/2".format(
|
|
116
|
+
realm
|
|
117
|
+
)
|
|
115
118
|
)
|
|
116
119
|
|
|
117
120
|
def _get_authorization_header(self):
|
|
@@ -7,6 +7,7 @@ from typing_extensions import Self
|
|
|
7
7
|
|
|
8
8
|
from office365.runtime.client_runtime_context import ClientRuntimeContext
|
|
9
9
|
from office365.runtime.client_value import ClientValue
|
|
10
|
+
from office365.runtime.http.request_options import RequestOptions
|
|
10
11
|
from office365.runtime.odata.json_format import ODataJsonFormat
|
|
11
12
|
from office365.runtime.odata.query_options import QueryOptions
|
|
12
13
|
from office365.runtime.odata.type import ODataType
|
|
@@ -34,7 +35,7 @@ class ClientObject(Generic[T]):
|
|
|
34
35
|
self._entity_type_name = None
|
|
35
36
|
self._resource_path = resource_path
|
|
36
37
|
|
|
37
|
-
def
|
|
38
|
+
def clear_state(self):
|
|
38
39
|
# type: () -> Self
|
|
39
40
|
"""Resets client object's state."""
|
|
40
41
|
self._properties = {
|
|
@@ -73,12 +74,16 @@ class ClientObject(Generic[T]):
|
|
|
73
74
|
)
|
|
74
75
|
return self
|
|
75
76
|
|
|
76
|
-
def
|
|
77
|
-
# type: (Callable[[
|
|
78
|
-
"""
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
def before_execute(self, action):
|
|
78
|
+
# type: (Callable[[RequestOptions], None]) -> Self
|
|
79
|
+
"""Attach an event handler to client object which gets triggered after query is submitted to server"""
|
|
80
|
+
self.context.before_execute(action)
|
|
81
|
+
return self
|
|
82
|
+
|
|
83
|
+
def after_execute(self, action, execute_first=False):
|
|
84
|
+
# type: (Callable[[Self], None], bool) -> Self
|
|
85
|
+
"""Attach an event handler to client object which gets triggered after query is submitted to server"""
|
|
86
|
+
self.context.after_query_execute(action, execute_first)
|
|
82
87
|
return self
|
|
83
88
|
|
|
84
89
|
def get(self):
|
|
@@ -138,13 +143,8 @@ class ClientObject(Generic[T]):
|
|
|
138
143
|
return self._properties.get(name, default_value)
|
|
139
144
|
|
|
140
145
|
def set_property(self, name, value, persist_changes=True):
|
|
141
|
-
# type: (str, P_T, bool) -> Self
|
|
142
|
-
"""Sets property value
|
|
143
|
-
|
|
144
|
-
:param str name: Property name
|
|
145
|
-
:param P_T value: Property value
|
|
146
|
-
:param bool persist_changes: Persist changes
|
|
147
|
-
"""
|
|
146
|
+
# type: (str|int, P_T, bool) -> Self
|
|
147
|
+
"""Sets property value"""
|
|
148
148
|
if persist_changes:
|
|
149
149
|
self._ser_property_names.append(name)
|
|
150
150
|
|
|
@@ -172,12 +172,12 @@ class ClientObject(Generic[T]):
|
|
|
172
172
|
return self
|
|
173
173
|
|
|
174
174
|
def ensure_property(self, name, action, *args, **kwargs):
|
|
175
|
-
# type: (str, Callable[
|
|
175
|
+
# type: (str, Callable[..., None], Optional[Any], Optional[Any]) -> Self
|
|
176
176
|
"""Ensures if property is loaded"""
|
|
177
177
|
return self.ensure_properties([name], action, *args, **kwargs)
|
|
178
178
|
|
|
179
179
|
def ensure_properties(self, names, action, *args, **kwargs):
|
|
180
|
-
# type: (List[str], Callable[
|
|
180
|
+
# type: (List[str], Callable[..., None], Any, Any) -> Self
|
|
181
181
|
"""Ensure if list of properties are retrieved from the server"""
|
|
182
182
|
if self.property_ref_name is not None and self.property_ref_name not in names:
|
|
183
183
|
names.append(self.property_ref_name)
|
|
@@ -187,7 +187,11 @@ class ClientObject(Generic[T]):
|
|
|
187
187
|
from office365.runtime.queries.read_entity import ReadEntityQuery
|
|
188
188
|
|
|
189
189
|
qry = ReadEntityQuery(self, names_to_include)
|
|
190
|
-
|
|
190
|
+
|
|
191
|
+
def _after_loaded(return_type):
|
|
192
|
+
action(*args, **kwargs)
|
|
193
|
+
|
|
194
|
+
self.context.add_query(qry).after_query_execute(_after_loaded)
|
|
191
195
|
else:
|
|
192
196
|
action(*args, **kwargs)
|
|
193
197
|
return self
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Callable, Generic, Iterator, List, Optional, Type, TypeVar
|
|
2
2
|
|
|
3
3
|
from typing_extensions import Self
|
|
4
4
|
|
|
@@ -25,7 +25,7 @@ class ClientObjectCollection(ClientObject, Generic[T]):
|
|
|
25
25
|
self._next_request_url = None
|
|
26
26
|
self._parent = parent
|
|
27
27
|
|
|
28
|
-
def
|
|
28
|
+
def clear_state(self):
|
|
29
29
|
"""Clears client object collection"""
|
|
30
30
|
if not self._paged_mode:
|
|
31
31
|
self._data = []
|
|
@@ -147,12 +147,6 @@ class ClientObjectCollection(ClientObject, Generic[T]):
|
|
|
147
147
|
self.top(page_size)
|
|
148
148
|
return self
|
|
149
149
|
|
|
150
|
-
def after_execute(self, action, *args, **kwargs):
|
|
151
|
-
# type: (Callable[[Self, Any, Any], None], Any, Any) -> Self
|
|
152
|
-
super(ClientObjectCollection, self).after_execute(action, *args, **kwargs)
|
|
153
|
-
self._page_loaded += action
|
|
154
|
-
return self
|
|
155
|
-
|
|
156
150
|
def get(self):
|
|
157
151
|
# type: () -> Self
|
|
158
152
|
|
|
@@ -160,39 +154,30 @@ class ClientObjectCollection(ClientObject, Generic[T]):
|
|
|
160
154
|
# type: (Self) -> None
|
|
161
155
|
self._page_loaded.notify(self)
|
|
162
156
|
|
|
163
|
-
self.context.load(self
|
|
157
|
+
self.context.load(self).after_query_execute(_loaded)
|
|
164
158
|
return self
|
|
165
159
|
|
|
166
160
|
def get_all(self, page_size=None, page_loaded=None):
|
|
167
161
|
# type: (int, Callable[[Self], None]) -> Self
|
|
168
162
|
"""Gets all the items in a collection, regardless of the size."""
|
|
169
163
|
|
|
170
|
-
self.paged(page_size, page_loaded)
|
|
171
|
-
|
|
172
164
|
def _page_loaded(col):
|
|
173
165
|
# type: (Self) -> None
|
|
174
|
-
self._page_loaded.notify(col)
|
|
175
166
|
if self.has_next:
|
|
176
|
-
self._get_next(
|
|
167
|
+
self._get_next().after_execute(_page_loaded)
|
|
177
168
|
|
|
178
|
-
self.
|
|
169
|
+
self.paged(page_size, page_loaded).get().after_execute(_page_loaded)
|
|
179
170
|
return self
|
|
180
171
|
|
|
181
|
-
def _get_next(self
|
|
182
|
-
# type: (
|
|
183
|
-
"""
|
|
184
|
-
Submit a request to retrieve next collection of items
|
|
185
|
-
:param (ClientObjectCollection) -> None after_loaded: Page loaded event
|
|
186
|
-
"""
|
|
172
|
+
def _get_next(self):
|
|
173
|
+
# type: () -> Self
|
|
174
|
+
"""Submit a request to retrieve next collection of items"""
|
|
187
175
|
|
|
188
176
|
def _construct_request(request):
|
|
189
177
|
# type: (RequestOptions) -> None
|
|
190
178
|
request.url = self._next_request_url
|
|
191
179
|
|
|
192
|
-
self.
|
|
193
|
-
self, before_loaded=_construct_request, after_loaded=after_loaded
|
|
194
|
-
)
|
|
195
|
-
return self
|
|
180
|
+
return self.get().before_execute(_construct_request)
|
|
196
181
|
|
|
197
182
|
def first(self, expression):
|
|
198
183
|
# type: (str) -> T
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import copy
|
|
2
|
-
from typing import TYPE_CHECKING,
|
|
2
|
+
from typing import TYPE_CHECKING, Callable, Generic, Optional, TypeVar
|
|
3
3
|
|
|
4
4
|
from typing_extensions import Self
|
|
5
5
|
|
|
6
|
+
from office365.runtime.http.request_options import RequestOptions
|
|
7
|
+
|
|
6
8
|
if TYPE_CHECKING:
|
|
7
9
|
from office365.runtime.client_runtime_context import ClientRuntimeContext # noqa
|
|
8
10
|
from office365.runtime.client_value import ClientValue # noqa
|
|
@@ -19,21 +21,16 @@ class ClientResult(Generic[T]):
|
|
|
19
21
|
self._context = context
|
|
20
22
|
self._value = copy.deepcopy(default_value) # type: T
|
|
21
23
|
|
|
22
|
-
def before_execute(self, action
|
|
23
|
-
|
|
24
|
-
Attach an event handler which is triggered before query is submitted to server
|
|
25
|
-
|
|
26
|
-
"""
|
|
27
|
-
self._context.before_query_execute(action, *args, **kwargs)
|
|
24
|
+
def before_execute(self, action):
|
|
25
|
+
# type: (Callable[[RequestOptions], None]) -> Self
|
|
26
|
+
"""Attach an event handler which is triggered before query is submitted to server"""
|
|
27
|
+
self._context.before_query_execute(action)
|
|
28
28
|
return self
|
|
29
29
|
|
|
30
|
-
def after_execute(self, action,
|
|
31
|
-
# type: (Callable[[Self], None],
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
:param (ClientResult) -> None action: Event handler
|
|
35
|
-
"""
|
|
36
|
-
self._context.after_query_execute(action, self, *args, **kwargs)
|
|
30
|
+
def after_execute(self, action, execute_first=False):
|
|
31
|
+
# type: (Callable[[Self], None], bool) -> Self
|
|
32
|
+
"""Attach an event handler which is triggered after query is submitted to server"""
|
|
33
|
+
self._context.after_query_execute(action, execute_first)
|
|
37
34
|
return self
|
|
38
35
|
|
|
39
36
|
def set_property(self, key, value, persist_changes=False):
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import abc
|
|
2
2
|
from time import sleep
|
|
3
|
-
from typing import TYPE_CHECKING,
|
|
3
|
+
from typing import TYPE_CHECKING, AnyStr, Callable, List
|
|
4
4
|
|
|
5
5
|
import requests
|
|
6
|
+
from requests import Response
|
|
6
7
|
from typing_extensions import Self
|
|
7
8
|
|
|
8
9
|
from office365.runtime.client_request import ClientRequest
|
|
@@ -33,9 +34,7 @@ class ClientRuntimeContext(object):
|
|
|
33
34
|
|
|
34
35
|
def build_request(self, query):
|
|
35
36
|
# type: (ClientQuery) -> RequestOptions
|
|
36
|
-
"""
|
|
37
|
-
Builds a request
|
|
38
|
-
"""
|
|
37
|
+
"""Builds a request"""
|
|
39
38
|
self._current_query = query
|
|
40
39
|
request = self.pending_request().build_request(query)
|
|
41
40
|
self.pending_request().beforeExecute.notify(request)
|
|
@@ -81,25 +80,15 @@ class ClientRuntimeContext(object):
|
|
|
81
80
|
# type: () -> str
|
|
82
81
|
pass
|
|
83
82
|
|
|
84
|
-
def load(
|
|
85
|
-
|
|
86
|
-
client_object,
|
|
87
|
-
properties_to_retrieve=None,
|
|
88
|
-
before_loaded=None,
|
|
89
|
-
after_loaded=None,
|
|
90
|
-
):
|
|
91
|
-
# type: (T, List[str], Callable[[RequestOptions], None], Callable[[T], None]) -> Self
|
|
83
|
+
def load(self, client_object, properties_to_retrieve=None):
|
|
84
|
+
# type: (T, List[str]) -> Self
|
|
92
85
|
"""Prepare retrieval query"""
|
|
93
86
|
qry = ReadEntityQuery(client_object, properties_to_retrieve)
|
|
94
87
|
self.add_query(qry)
|
|
95
|
-
if callable(before_loaded):
|
|
96
|
-
self.before_query_execute(before_loaded)
|
|
97
|
-
if callable(after_loaded):
|
|
98
|
-
self.after_query_execute(after_loaded, client_object)
|
|
99
88
|
return self
|
|
100
89
|
|
|
101
|
-
def before_query_execute(self, action, once=True
|
|
102
|
-
# type: (Callable[[RequestOptions
|
|
90
|
+
def before_query_execute(self, action, once=True):
|
|
91
|
+
# type: (Callable[[RequestOptions], None], bool) -> Self
|
|
103
92
|
"""
|
|
104
93
|
Attach an event handler which is triggered before query is submitted to server
|
|
105
94
|
|
|
@@ -115,13 +104,13 @@ class ClientRuntimeContext(object):
|
|
|
115
104
|
if self.current_query.id == query.id:
|
|
116
105
|
if once:
|
|
117
106
|
self.pending_request().beforeExecute -= _prepare_request
|
|
118
|
-
action(request
|
|
107
|
+
action(request)
|
|
119
108
|
|
|
120
109
|
self.pending_request().beforeExecute += _prepare_request
|
|
121
110
|
return self
|
|
122
111
|
|
|
123
|
-
def before_execute(self, action, once=True
|
|
124
|
-
# type: (Callable[[RequestOptions
|
|
112
|
+
def before_execute(self, action, once=True):
|
|
113
|
+
# type: (Callable[[RequestOptions], None], bool) -> Self
|
|
125
114
|
"""
|
|
126
115
|
Attach an event handler which is triggered before request is submitted to server
|
|
127
116
|
:param (office365.runtime.http.request_options.RequestOptions, any) -> None action:
|
|
@@ -132,48 +121,47 @@ class ClientRuntimeContext(object):
|
|
|
132
121
|
# type: (RequestOptions) -> None
|
|
133
122
|
if once:
|
|
134
123
|
self.pending_request().beforeExecute -= _process_request
|
|
135
|
-
action(request
|
|
124
|
+
action(request)
|
|
136
125
|
|
|
137
126
|
self.pending_request().beforeExecute += _process_request
|
|
138
127
|
return self
|
|
139
128
|
|
|
140
|
-
def after_query_execute(self, action,
|
|
141
|
-
# type: (Callable[[
|
|
129
|
+
def after_query_execute(self, action, execute_first=False):
|
|
130
|
+
# type: (Callable[[T], None], bool) -> Self
|
|
142
131
|
"""Attach an event handler which is triggered after query is submitted to server"""
|
|
143
132
|
if len(self._queries) == 0:
|
|
144
133
|
return
|
|
145
134
|
query = self._queries[-1]
|
|
146
135
|
|
|
147
136
|
def _process_response(resp):
|
|
148
|
-
# type: (
|
|
137
|
+
# type: (Response) -> None
|
|
149
138
|
resp.raise_for_status()
|
|
150
139
|
if self.current_query.id == query.id:
|
|
151
140
|
self.pending_request().afterExecute -= _process_response
|
|
152
|
-
action(
|
|
141
|
+
action(query.return_type)
|
|
153
142
|
|
|
154
143
|
self.pending_request().afterExecute += _process_response
|
|
155
144
|
|
|
156
|
-
execute_first = kwargs.pop("execute_first", False)
|
|
157
145
|
if execute_first and len(self._queries) > 1:
|
|
158
146
|
self._queries.insert(0, self._queries.pop())
|
|
159
147
|
|
|
160
148
|
return self
|
|
161
149
|
|
|
162
|
-
def after_execute(self, action, once=True
|
|
163
|
-
# type: (Callable[[
|
|
150
|
+
def after_execute(self, action, once=True):
|
|
151
|
+
# type: (Callable[[Response], None], bool) -> Self
|
|
164
152
|
"""Attach an event handler which is triggered after request is submitted to server"""
|
|
165
153
|
|
|
166
154
|
def _process_response(response):
|
|
167
|
-
# type: (
|
|
155
|
+
# type: (Response) -> None
|
|
168
156
|
if once:
|
|
169
157
|
self.pending_request().afterExecute -= _process_response
|
|
170
|
-
action(response
|
|
158
|
+
action(response)
|
|
171
159
|
|
|
172
160
|
self.pending_request().afterExecute += _process_response
|
|
173
161
|
return self
|
|
174
162
|
|
|
175
163
|
def execute_request_direct(self, path):
|
|
176
|
-
# type: (str) ->
|
|
164
|
+
# type: (str) -> Response
|
|
177
165
|
full_url = "".join([self.service_root_url(), "/", path])
|
|
178
166
|
request = RequestOptions(full_url)
|
|
179
167
|
return self.pending_request().execute_request_direct(request)
|
|
@@ -24,15 +24,12 @@ class ODataJsonFormat(object):
|
|
|
24
24
|
|
|
25
25
|
@property
|
|
26
26
|
def media_type(self):
|
|
27
|
-
|
|
28
|
-
Gets media type
|
|
29
|
-
:rtype: str
|
|
30
|
-
"""
|
|
27
|
+
# type: () -> str
|
|
28
|
+
"""Gets media type"""
|
|
31
29
|
raise NotImplementedError
|
|
32
30
|
|
|
33
31
|
@property
|
|
34
32
|
def include_control_information(self):
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"""
|
|
33
|
+
# type: () -> bool
|
|
34
|
+
"""Determines whether control information that is represented as annotations should be included in payload"""
|
|
38
35
|
raise NotImplementedError
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import copy
|
|
2
|
-
from typing import Any, Optional
|
|
2
|
+
from typing import Any, Iterator, Optional, Tuple
|
|
3
3
|
|
|
4
4
|
import requests
|
|
5
5
|
|
|
@@ -54,7 +54,7 @@ class ODataRequest(ClientRequest):
|
|
|
54
54
|
return
|
|
55
55
|
|
|
56
56
|
if isinstance(return_type, ClientObject):
|
|
57
|
-
return_type.
|
|
57
|
+
return_type.clear_state()
|
|
58
58
|
|
|
59
59
|
if (
|
|
60
60
|
response.headers.get("Content-Type", "").lower().split(";")[0]
|
|
@@ -79,7 +79,7 @@ class ODataRequest(ClientRequest):
|
|
|
79
79
|
return_type.set_property(k, v, False)
|
|
80
80
|
|
|
81
81
|
def _next_property(self, json, json_format):
|
|
82
|
-
# type: (Any, ODataJsonFormat) ->
|
|
82
|
+
# type: (Any, ODataJsonFormat) -> Iterator[Tuple[str, Any]]
|
|
83
83
|
if isinstance(json_format, JsonLightFormat):
|
|
84
84
|
json = json.get(json_format.security, json)
|
|
85
85
|
json = json.get(json_format.function, json)
|