Office365-REST-Python-Client 2.5.5__py3-none-any.whl → 2.5.7__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.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/METADATA +6 -6
- {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/RECORD +269 -222
- office365/booking/virtualevents/__init__.py +0 -0
- office365/booking/virtualevents/root.py +5 -0
- office365/communications/calls/participant.py +4 -5
- office365/directory/administrative_unit.py +9 -2
- office365/directory/applications/application.py +3 -3
- office365/directory/applications/roles/assignment_collection.py +1 -1
- office365/directory/applications/roles/collection.py +6 -2
- office365/directory/applications/roles/role.py +1 -1
- office365/directory/audit/provisioning/object_summary.py +30 -1
- 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/methods/fido.py +8 -0
- office365/directory/authentication/methods/password.py +23 -0
- office365/directory/authentication/strength_root.py +5 -0
- office365/directory/certificates/auth_configuration.py +1 -3
- office365/directory/custom_security_attribute_definition.py +7 -0
- office365/directory/device_local_credential_info.py +6 -0
- office365/directory/directory.py +40 -12
- 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/builtin_identity.py +3 -2
- office365/directory/identities/providers/saml_or_wsfed.py +4 -5
- office365/directory/identitygovernance/appconsent/request_collection.py +1 -1
- 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/identitygovernance/termsofuse/agreement_acceptance.py +8 -0
- office365/directory/identitygovernance/userconsent/request_collection.py +1 -1
- office365/directory/insights/resource_reference.py +1 -1
- office365/directory/key_credential.py +3 -0
- office365/directory/licenses/assignment_state.py +26 -2
- office365/directory/licenses/details.py +4 -3
- 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/device_registration.py +6 -0
- office365/directory/policies/permission_grant.py +2 -0
- office365/directory/policies/root.py +13 -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/security/threatintelligence/article_indicator.py +7 -0
- office365/directory/serviceprincipals/service_principal.py +6 -12
- office365/directory/synchronization/schema.py +16 -0
- office365/directory/synchronization/synchronization.py +2 -0
- office365/directory/users/activities/history_item.py +3 -2
- office365/directory/users/user.py +60 -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 +76 -7
- office365/onedrive/files/hashes.py +5 -0
- office365/onedrive/lists/collection.py +2 -2
- office365/onedrive/lists/list.py +1 -1
- 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/sitepages/__init__.py +0 -0
- office365/onedrive/sitepages/base.py +29 -0
- office365/onedrive/sitepages/canvas_layout.py +43 -0
- office365/onedrive/sitepages/collection.py +32 -0
- office365/onedrive/sitepages/horizontal_section.py +23 -0
- office365/onedrive/sitepages/horizontal_section_column.py +27 -0
- office365/onedrive/sitepages/site_page.py +116 -0
- office365/onedrive/sitepages/title_area.py +13 -0
- office365/onedrive/sitepages/vertical_section.py +27 -0
- office365/onedrive/sitepages/web_part.py +5 -0
- office365/onedrive/sites/site.py +10 -0
- 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/charts/data_labels.py +13 -1
- 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/tables/sort.py +5 -0
- office365/onedrive/workbooks/tables/table.py +57 -0
- office365/onedrive/workbooks/worksheets/collection.py +0 -6
- office365/onedrive/workbooks/worksheets/protection.py +22 -1
- office365/onedrive/workbooks/worksheets/protection_options.py +7 -0
- office365/outlook/calendar/calendar.py +1 -3
- office365/outlook/calendar/events/event.py +45 -0
- office365/outlook/calendar/permissions/permission.py +7 -7
- office365/outlook/calendar/place.py +5 -3
- office365/outlook/calendar/response_status.py +11 -0
- office365/outlook/calendar/rooms/room.py +14 -0
- office365/outlook/mail/attachments/collection.py +6 -1
- office365/outlook/mail/automatic_replies_mailtips.py +5 -0
- office365/outlook/mail/conversation.py +1 -3
- office365/outlook/mail/folders/folder.py +1 -3
- office365/outlook/mail/messages/message.py +1 -1
- office365/outlook/mail/tips.py +17 -0
- office365/planner/plans/plan.py +11 -1
- office365/reports/root.py +83 -4
- office365/runtime/auth/authentication_context.py +12 -2
- office365/runtime/auth/providers/acs_token_provider.py +10 -7
- office365/runtime/auth/sts_profile.py +0 -1
- office365/runtime/client_object.py +18 -14
- office365/runtime/client_object_collection.py +8 -23
- office365/runtime/client_request_exception.py +1 -3
- office365/runtime/client_result.py +11 -14
- office365/runtime/client_runtime_context.py +11 -21
- office365/runtime/odata/json_format.py +7 -9
- office365/runtime/odata/request.py +12 -2
- office365/runtime/odata/v3/batch_request.py +7 -15
- office365/runtime/odata/v4/batch_request.py +13 -21
- office365/runtime/queries/upload_session.py +5 -0
- 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/collection.py +2 -1
- office365/sharepoint/attachments/attachment.py +3 -9
- 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 +4 -2
- 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/content_type.py +13 -1
- office365/sharepoint/contenttypes/fieldlinks/collection.py +5 -7
- office365/sharepoint/contenttypes/fieldlinks/field_link.py +14 -22
- office365/sharepoint/directory/helper.py +2 -0
- 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 +1 -2
- office365/sharepoint/features/definitions/definition.py +6 -3
- office365/sharepoint/fields/calculated.py +8 -14
- office365/sharepoint/fields/collection.py +46 -13
- 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/collection.py +17 -15
- office365/sharepoint/files/file.py +30 -23
- 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 +23 -25
- 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 +2 -2
- office365/sharepoint/lists/bloom_filter.py +5 -7
- office365/sharepoint/lists/creatables_info.py +5 -6
- office365/sharepoint/lists/list.py +24 -9
- 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/migrationcenter/deploy_status.py +5 -0
- office365/sharepoint/migrationcenter/service/performance/__init__.py +0 -0
- office365/sharepoint/migrationcenter/service/performance/dashboard_data.py +9 -0
- office365/sharepoint/migrationcenter/service/performance/data.py +7 -0
- office365/sharepoint/migrationcenter/service/performance/entity_data.py +5 -0
- 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/principal/principal.py +2 -4
- 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/recyclebin/item.py +107 -7
- office365/sharepoint/sharing/information.py +9 -0
- office365/sharepoint/sharing/link_info.py +6 -0
- office365/sharepoint/sharing/object_sharing_settings.py +24 -46
- office365/sharepoint/sharing/permission_collection.py +18 -0
- 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/script_safe_domain.py +5 -0
- office365/sharepoint/sites/site.py +17 -20
- office365/sharepoint/taxonomy/field.py +32 -21
- office365/sharepoint/taxonomy/field_value.py +1 -1
- 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/powerapps/__init__.py +0 -0
- office365/sharepoint/tenant/administration/powerapps/environment_context.py +8 -0
- 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/information_collection.py +1 -1
- office365/sharepoint/webs/modernize_homepage_result.py +4 -3
- office365/sharepoint/webs/regional_settings.py +79 -16
- office365/sharepoint/webs/template.py +3 -5
- office365/sharepoint/webs/web.py +24 -25
- office365/teams/apps/catalog.py +1 -0
- office365/teams/chats/chat.py +4 -0
- office365/teams/operations/async_operation.py +5 -7
- office365/teams/schedule/schedule.py +6 -2
- office365/runtime/paths/item.py +0 -8
- {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/top_level.txt +0 -0
|
@@ -65,3 +65,12 @@ class ItemActivityStat(Entity):
|
|
|
65
65
|
ResourcePath("activities", self.resource_path),
|
|
66
66
|
),
|
|
67
67
|
)
|
|
68
|
+
|
|
69
|
+
def get_property(self, name, default_value=None):
|
|
70
|
+
if default_value is None:
|
|
71
|
+
property_mapping = {
|
|
72
|
+
"endDateTime": self.end_datetime,
|
|
73
|
+
"startDateTime": self.start_datetime,
|
|
74
|
+
}
|
|
75
|
+
default_value = property_mapping.get(name, None)
|
|
76
|
+
return super(ItemActivityStat, self).get_property(name, default_value)
|
|
@@ -20,9 +20,7 @@ class ContentType(BaseItem):
|
|
|
20
20
|
columns that must be present on every listItem in a list."""
|
|
21
21
|
|
|
22
22
|
def is_published(self):
|
|
23
|
-
"""
|
|
24
|
-
Check the publishing status of a contentType in a content type hub site.
|
|
25
|
-
"""
|
|
23
|
+
"""Check the publishing status of a contentType in a content type hub site."""
|
|
26
24
|
return_type = ClientResult(self.context, bool())
|
|
27
25
|
qry = FunctionQuery(self, "isPublished", None, return_type)
|
|
28
26
|
self.context.add_query(qry)
|
|
@@ -57,9 +55,7 @@ class ContentType(BaseItem):
|
|
|
57
55
|
return self
|
|
58
56
|
|
|
59
57
|
def unpublish(self):
|
|
60
|
-
"""
|
|
61
|
-
Unpublish a contentType from a content type hub site.
|
|
62
|
-
"""
|
|
58
|
+
"""Unpublish a contentType from a content type hub site."""
|
|
63
59
|
qry = ServiceOperationQuery(self, "unpublish")
|
|
64
60
|
self.context.add_query(qry)
|
|
65
61
|
return self
|
|
@@ -75,9 +71,7 @@ class ContentType(BaseItem):
|
|
|
75
71
|
|
|
76
72
|
@property
|
|
77
73
|
def document_set(self):
|
|
78
|
-
"""
|
|
79
|
-
Document Set metadata.
|
|
80
|
-
"""
|
|
74
|
+
"""Document Set metadata."""
|
|
81
75
|
return self.properties.get("documentSet", DocumentSet())
|
|
82
76
|
|
|
83
77
|
@property
|
|
@@ -115,9 +109,7 @@ class ContentType(BaseItem):
|
|
|
115
109
|
@property
|
|
116
110
|
def read_only(self):
|
|
117
111
|
# type: () -> Optional[bool]
|
|
118
|
-
"""
|
|
119
|
-
If true, the content type cannot be modified unless this value is first set to false.
|
|
120
|
-
"""
|
|
112
|
+
"""If true, the content type cannot be modified unless this value is first set to false."""
|
|
121
113
|
return self.properties.get("readOnly", None)
|
|
122
114
|
|
|
123
115
|
@property
|
|
@@ -2,6 +2,8 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
from datetime import datetime
|
|
5
|
+
from functools import partial
|
|
6
|
+
from os.path import isfile, join
|
|
5
7
|
from typing import IO, AnyStr, Callable, Optional, TypeVar
|
|
6
8
|
|
|
7
9
|
import requests
|
|
@@ -209,7 +211,8 @@ class DriveItem(BaseItem):
|
|
|
209
211
|
:param int chunk_size: chunk size
|
|
210
212
|
"""
|
|
211
213
|
|
|
212
|
-
def _start_upload():
|
|
214
|
+
def _start_upload(result):
|
|
215
|
+
# type: (ClientResult[UploadSession]) -> None
|
|
213
216
|
with open(source_path, "rb") as local_file:
|
|
214
217
|
session_request = UploadSessionRequest(
|
|
215
218
|
local_file, chunk_size, chunk_uploaded
|
|
@@ -271,6 +274,30 @@ class DriveItem(BaseItem):
|
|
|
271
274
|
name = os.path.basename(path_or_file)
|
|
272
275
|
return self.upload(name, content)
|
|
273
276
|
|
|
277
|
+
def upload_folder(self, path, file_uploaded=None):
|
|
278
|
+
# type: (str, Callable[["DriveItem"], None]) -> "DriveItem"
|
|
279
|
+
|
|
280
|
+
def _after_file_upload(return_type):
|
|
281
|
+
# type: ("DriveItem") -> None
|
|
282
|
+
if callable(file_uploaded):
|
|
283
|
+
file_uploaded(return_type)
|
|
284
|
+
|
|
285
|
+
def _upload_folder(source_path, target_folder):
|
|
286
|
+
# type: (str, "DriveItem") -> None
|
|
287
|
+
for name in os.listdir(source_path):
|
|
288
|
+
cur_path = join(source_path, name)
|
|
289
|
+
if isfile(cur_path):
|
|
290
|
+
with open(cur_path, "rb") as f:
|
|
291
|
+
target_folder.upload_file(f).after_execute(_after_file_upload)
|
|
292
|
+
else:
|
|
293
|
+
target_folder.create_folder(name).after_execute(
|
|
294
|
+
partial(_upload_folder, cur_path)
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
"""Uploads a folder"""
|
|
298
|
+
_upload_folder(path, self)
|
|
299
|
+
return self
|
|
300
|
+
|
|
274
301
|
def get_content(self, format_name=None):
|
|
275
302
|
# type: (Optional[str]) -> ClientResult[AnyStr]
|
|
276
303
|
"""
|
|
@@ -301,6 +328,52 @@ class DriveItem(BaseItem):
|
|
|
301
328
|
self.get_content().after_execute(_save_content)
|
|
302
329
|
return self
|
|
303
330
|
|
|
331
|
+
def download_folder(
|
|
332
|
+
self, download_file, after_file_downloaded=None, recursive=True
|
|
333
|
+
):
|
|
334
|
+
# type: (IO, Callable[[File], None], bool) -> "DriveItem"
|
|
335
|
+
"""
|
|
336
|
+
Download the folder content
|
|
337
|
+
"""
|
|
338
|
+
import zipfile
|
|
339
|
+
|
|
340
|
+
def _after_file_downloaded(drive_item, base_path, result):
|
|
341
|
+
# type: ("DriveItem", str, ClientResult[AnyStr]) -> None
|
|
342
|
+
with zipfile.ZipFile(download_file.name, "a", zipfile.ZIP_DEFLATED) as zf:
|
|
343
|
+
zip_path = (
|
|
344
|
+
"/".join([base_path, drive_item.name])
|
|
345
|
+
if base_path is not None
|
|
346
|
+
else drive_item.name
|
|
347
|
+
)
|
|
348
|
+
zf.writestr(zip_path, result.value)
|
|
349
|
+
if callable(after_file_downloaded):
|
|
350
|
+
after_file_downloaded(drive_item)
|
|
351
|
+
|
|
352
|
+
def _after_folder_downloaded(parent_item, base_path=None):
|
|
353
|
+
# type: ("DriveItem", str) -> None
|
|
354
|
+
for drive_item in parent_item.children:
|
|
355
|
+
if drive_item.is_file:
|
|
356
|
+
drive_item.get_content().after_execute(
|
|
357
|
+
partial(_after_file_downloaded, drive_item, base_path)
|
|
358
|
+
)
|
|
359
|
+
else:
|
|
360
|
+
if recursive:
|
|
361
|
+
if base_path is None:
|
|
362
|
+
next_base_path = str(drive_item.name)
|
|
363
|
+
else:
|
|
364
|
+
next_base_path = "/".join([base_path, drive_item.name])
|
|
365
|
+
_download_folder(drive_item, next_base_path)
|
|
366
|
+
|
|
367
|
+
def _download_folder(drive_item, prev_result=None):
|
|
368
|
+
# type: ("DriveItem", str) -> None
|
|
369
|
+
drive_item.ensure_properties(
|
|
370
|
+
["children", "name"],
|
|
371
|
+
partial(_after_folder_downloaded, drive_item, prev_result),
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
_download_folder(self)
|
|
375
|
+
return self
|
|
376
|
+
|
|
304
377
|
def download_session(
|
|
305
378
|
self, file_object, chunk_downloaded=None, chunk_size=1024 * 1024
|
|
306
379
|
):
|
|
@@ -599,9 +672,7 @@ class DriveItem(BaseItem):
|
|
|
599
672
|
@property
|
|
600
673
|
def audio(self):
|
|
601
674
|
# type: () -> Audio
|
|
602
|
-
"""
|
|
603
|
-
Audio metadata, if the item is an audio file. Read-only.
|
|
604
|
-
"""
|
|
675
|
+
"""Audio metadata, if the item is an audio file. Read-only."""
|
|
605
676
|
return self.properties.get("audio", Audio())
|
|
606
677
|
|
|
607
678
|
@property
|
|
@@ -615,9 +686,7 @@ class DriveItem(BaseItem):
|
|
|
615
686
|
@property
|
|
616
687
|
def photo(self):
|
|
617
688
|
# type: () -> Photo
|
|
618
|
-
"""
|
|
619
|
-
Photo metadata, if the item is a photo. Read-only.
|
|
620
|
-
"""
|
|
689
|
+
"""Photo metadata, if the item is a photo. Read-only."""
|
|
621
690
|
return self.properties.get("photo", Photo())
|
|
622
691
|
|
|
623
692
|
@property
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from office365.entity_collection import EntityCollection
|
|
2
2
|
from office365.onedrive.lists.list import List
|
|
3
|
-
from office365.runtime.paths.
|
|
3
|
+
from office365.runtime.paths.v4.entity import EntityPath
|
|
4
4
|
from office365.runtime.queries.create_entity import CreateEntityQuery
|
|
5
5
|
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ class ListCollection(EntityCollection[List]):
|
|
|
17
17
|
:param str display_name: The displayable title of the list.
|
|
18
18
|
:param str list_template: The base list template used in creating the list
|
|
19
19
|
"""
|
|
20
|
-
return_type = List(self.context,
|
|
20
|
+
return_type = List(self.context, EntityPath(None, self.resource_path))
|
|
21
21
|
self.add_child(return_type)
|
|
22
22
|
payload = {
|
|
23
23
|
"displayName": display_name,
|
office365/onedrive/lists/list.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.entity import Entity
|
|
2
4
|
|
|
3
5
|
|
|
@@ -6,14 +8,12 @@ class LongRunningOperation(Entity):
|
|
|
6
8
|
|
|
7
9
|
@property
|
|
8
10
|
def resource_location(self):
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"""
|
|
11
|
+
# type: () -> Optional[str]
|
|
12
|
+
"""URI of the resource that the operation is performed on."""
|
|
12
13
|
return self.properties.get("resourceLocation", None)
|
|
13
14
|
|
|
14
15
|
@property
|
|
15
16
|
def status_detail(self):
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"""
|
|
17
|
+
# type: () -> Optional[str]
|
|
18
|
+
"""Details about the status of the operation."""
|
|
19
19
|
return self.properties.get("statusDetail", None)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.onedrive.operations.long_running import LongRunningOperation
|
|
2
4
|
|
|
3
5
|
|
|
@@ -6,7 +8,6 @@ class RichLongRunningOperation(LongRunningOperation):
|
|
|
6
8
|
|
|
7
9
|
@property
|
|
8
10
|
def resource_id(self):
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"""
|
|
11
|
+
# type: () -> Optional[str]
|
|
12
|
+
"""The unique identifier for the result."""
|
|
12
13
|
return self.properties.get("resourceId", None)
|
|
@@ -69,19 +69,6 @@ class PermissionCollection(EntityCollection[Permission]):
|
|
|
69
69
|
identity.ensure_properties(["displayName"], _add)
|
|
70
70
|
return return_type
|
|
71
71
|
|
|
72
|
-
def delete(self, roles, identity):
|
|
73
|
-
# type: (list[str], Application|User|Group|Device) -> Permission
|
|
74
|
-
"""Deletes the permission."""
|
|
75
|
-
|
|
76
|
-
def _delete(col):
|
|
77
|
-
pass
|
|
78
|
-
|
|
79
|
-
def _identity_loaded():
|
|
80
|
-
self.get_all(page_loaded=_delete)
|
|
81
|
-
|
|
82
|
-
identity.ensure_property("id", _identity_loaded)
|
|
83
|
-
return self
|
|
84
|
-
|
|
85
72
|
def delete_all(self):
|
|
86
73
|
"""Remove all access to resource"""
|
|
87
74
|
|
|
@@ -90,5 +77,5 @@ class PermissionCollection(EntityCollection[Permission]):
|
|
|
90
77
|
for permission in return_type:
|
|
91
78
|
permission.delete_object()
|
|
92
79
|
|
|
93
|
-
self.
|
|
80
|
+
self.get().after_execute(_after_loaded)
|
|
94
81
|
return self
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.entity import Entity
|
|
2
4
|
from office365.runtime.types.collections import StringCollection
|
|
3
5
|
|
|
@@ -26,26 +28,24 @@ class SharepointSettings(Entity):
|
|
|
26
28
|
|
|
27
29
|
@property
|
|
28
30
|
def site_creation_default_managed_path(self):
|
|
31
|
+
# type: () -> Optional[str]
|
|
29
32
|
"""
|
|
30
33
|
The value of the team site managed path. This is the path under which new team sites will be created.
|
|
31
|
-
:rtype: str
|
|
32
34
|
"""
|
|
33
35
|
return self.properties.get("siteCreationDefaultManagedPath", None)
|
|
34
36
|
|
|
35
37
|
@property
|
|
36
38
|
def site_creation_default_storage_limit_in_mb(self):
|
|
37
|
-
|
|
38
|
-
The default storage quota for a new site upon creation. Measured in megabytes (MB).
|
|
39
|
-
:rtype: int
|
|
40
|
-
"""
|
|
39
|
+
# type: () -> Optional[int]
|
|
40
|
+
"""The default storage quota for a new site upon creation. Measured in megabytes (MB)."""
|
|
41
41
|
return self.properties.get("siteCreationDefaultStorageLimitInMB", None)
|
|
42
42
|
|
|
43
43
|
@property
|
|
44
44
|
def tenant_default_timezone(self):
|
|
45
|
+
# type: () -> Optional[str]
|
|
45
46
|
"""
|
|
46
47
|
The default timezone of a tenant for newly created sites. For a list of possible values,
|
|
47
48
|
see SPRegionalSettings.TimeZones property.
|
|
48
|
-
:rtype: str
|
|
49
49
|
"""
|
|
50
50
|
return self.properties.get("tenantDefaultTimezone", None)
|
|
51
51
|
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from office365.base_item import BaseItem
|
|
4
|
+
from office365.onedrive.driveitems.publication_facet import PublicationFacet
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class BaseSitePage(BaseItem):
|
|
8
|
+
"""An abstract type that represents a page in the site page library."""
|
|
9
|
+
|
|
10
|
+
@property
|
|
11
|
+
def publishing_state(self):
|
|
12
|
+
# type: () -> Optional[str]
|
|
13
|
+
"""The publishing status and the MM.mm version of the page."""
|
|
14
|
+
return self.properties.get("publishingState", PublicationFacet())
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def page_layout(self):
|
|
18
|
+
# type: () -> Optional[str]
|
|
19
|
+
"""
|
|
20
|
+
The name of the page layout of the page.
|
|
21
|
+
The possible values are: microsoftReserved, article, home, unknownFutureValue.
|
|
22
|
+
"""
|
|
23
|
+
return self.properties.get("pageLayout", None)
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def title(self):
|
|
27
|
+
# type: () -> Optional[str]
|
|
28
|
+
"""Title of the sitePage."""
|
|
29
|
+
return self.properties.get("title", None)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
from office365.entity_collection import EntityCollection
|
|
3
|
+
from office365.onedrive.sitepages.horizontal_section import HorizontalSection
|
|
4
|
+
from office365.onedrive.sitepages.vertical_section import VerticalSection
|
|
5
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CanvasLayout(Entity):
|
|
9
|
+
"""Represents the layout of the content in a given SharePoint page."""
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
def horizontal_sections(self):
|
|
13
|
+
# type: () -> EntityCollection[HorizontalSection]
|
|
14
|
+
"""Collection of horizontal sections on the SharePoint page.."""
|
|
15
|
+
return self.properties.get(
|
|
16
|
+
"horizontalSections",
|
|
17
|
+
EntityCollection(
|
|
18
|
+
self.context,
|
|
19
|
+
HorizontalSection,
|
|
20
|
+
ResourcePath("horizontalSections", self.resource_path),
|
|
21
|
+
),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def vertical_section(self):
|
|
26
|
+
# type: () -> VerticalSection
|
|
27
|
+
"""Vertical section on the SharePoint page."""
|
|
28
|
+
return self.properties.get(
|
|
29
|
+
"verticalSection",
|
|
30
|
+
VerticalSection(
|
|
31
|
+
self.context,
|
|
32
|
+
ResourcePath("verticalSection", self.resource_path),
|
|
33
|
+
),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def get_property(self, name, default_value=None):
|
|
37
|
+
if default_value is None:
|
|
38
|
+
property_mapping = {
|
|
39
|
+
"horizontalSections": self.horizontal_sections,
|
|
40
|
+
"verticalSection": self.vertical_section,
|
|
41
|
+
}
|
|
42
|
+
default_value = property_mapping.get(name, None)
|
|
43
|
+
return super(CanvasLayout, self).get_property(name, default_value)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from office365.entity_collection import EntityCollection
|
|
2
|
+
from office365.onedrive.sitepages.site_page import SitePage
|
|
3
|
+
from office365.onedrive.sitepages.title_area import TitleArea
|
|
4
|
+
from office365.runtime.http.request_options import RequestOptions
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SitePageCollection(EntityCollection[SitePage]):
|
|
8
|
+
"""Sites container"""
|
|
9
|
+
|
|
10
|
+
def __init__(self, context, resource_path=None):
|
|
11
|
+
super(SitePageCollection, self).__init__(context, SitePage, resource_path)
|
|
12
|
+
|
|
13
|
+
def add(self, title):
|
|
14
|
+
"""
|
|
15
|
+
Create a new sitePage in the site pages list in a site.
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def _construct_request(request):
|
|
20
|
+
# type: (RequestOptions) -> None
|
|
21
|
+
request.set_header("Content-Type", "application/json")
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
super(SitePageCollection, self)
|
|
25
|
+
.add(
|
|
26
|
+
title=title,
|
|
27
|
+
name="{0}.aspx".format(title),
|
|
28
|
+
pageLayout="article",
|
|
29
|
+
titleArea=TitleArea(),
|
|
30
|
+
)
|
|
31
|
+
.before_execute(_construct_request)
|
|
32
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
from office365.entity_collection import EntityCollection
|
|
3
|
+
from office365.onedrive.sitepages.horizontal_section_column import (
|
|
4
|
+
HorizontalSectionColumn,
|
|
5
|
+
)
|
|
6
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HorizontalSection(Entity):
|
|
10
|
+
"""Represents a horizontal section in a given SharePoint page."""
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def columns(self):
|
|
14
|
+
# type: () -> EntityCollection[HorizontalSectionColumn]
|
|
15
|
+
"""The set of vertical columns in this section."""
|
|
16
|
+
return self.properties.get(
|
|
17
|
+
"columns",
|
|
18
|
+
EntityCollection(
|
|
19
|
+
self.context,
|
|
20
|
+
HorizontalSectionColumn,
|
|
21
|
+
ResourcePath("columns", self.resource_path),
|
|
22
|
+
),
|
|
23
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
from office365.entity_collection import EntityCollection
|
|
3
|
+
from office365.onedrive.sitepages.web_part import WebPart
|
|
4
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class HorizontalSectionColumn(Entity):
|
|
8
|
+
"""Represents a vertical column in a given horizontal section."""
|
|
9
|
+
|
|
10
|
+
@property
|
|
11
|
+
def web_parts(self):
|
|
12
|
+
# type: () -> EntityCollection[WebPart]
|
|
13
|
+
"""The set of web parts in this section."""
|
|
14
|
+
return self.properties.get(
|
|
15
|
+
"webParts",
|
|
16
|
+
EntityCollection(
|
|
17
|
+
self.context, WebPart, ResourcePath("webParts", self.resource_path)
|
|
18
|
+
),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def get_property(self, name, default_value=None):
|
|
22
|
+
if default_value is None:
|
|
23
|
+
property_mapping = {
|
|
24
|
+
"webParts": self.web_parts,
|
|
25
|
+
}
|
|
26
|
+
default_value = property_mapping.get(name, None)
|
|
27
|
+
return super(HorizontalSectionColumn, self).get_property(name, default_value)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from office365.entity_collection import EntityCollection
|
|
4
|
+
from office365.onedrive.sitepages.base import BaseSitePage
|
|
5
|
+
from office365.onedrive.sitepages.canvas_layout import CanvasLayout
|
|
6
|
+
from office365.onedrive.sitepages.title_area import TitleArea
|
|
7
|
+
from office365.onedrive.sitepages.web_part import WebPart
|
|
8
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
9
|
+
from office365.runtime.queries.function import FunctionQuery
|
|
10
|
+
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SitePage(BaseSitePage):
|
|
14
|
+
"""This resource represents a page in the sitePages list. It contains the title, layout, and a collection of
|
|
15
|
+
webParts."""
|
|
16
|
+
|
|
17
|
+
def get_web_parts_by_position(
|
|
18
|
+
self, webPartIndex, horizontalSectionId, isInVerticalSection, columnId
|
|
19
|
+
):
|
|
20
|
+
"""
|
|
21
|
+
Get a collection of webPart by providing webPartPosition information.
|
|
22
|
+
|
|
23
|
+
:param float webPartIndex: Index of the current WebPart. Represents the order of WebPart in this column or
|
|
24
|
+
section. Only works if either columnId or isInVerticalSection is provided.
|
|
25
|
+
:param float horizontalSectionId: Indicate the horizontal section where the WebPart located in.
|
|
26
|
+
:param bool isInVerticalSection: Indicate whether the WebPart located in the vertical section.
|
|
27
|
+
:param float columnId: Indicate the identifier of the column where the WebPart located in. Only works
|
|
28
|
+
if horizontalSectionId is provided.
|
|
29
|
+
"""
|
|
30
|
+
params = {
|
|
31
|
+
"webPartIndex": webPartIndex,
|
|
32
|
+
"horizontalSectionId": horizontalSectionId,
|
|
33
|
+
"isInverticalSection": isInVerticalSection,
|
|
34
|
+
"columnId": columnId,
|
|
35
|
+
}
|
|
36
|
+
return_type = EntityCollection(
|
|
37
|
+
self.context, WebPart, ResourcePath("webParts", self.resource_path)
|
|
38
|
+
)
|
|
39
|
+
qry = FunctionQuery(self, "getWebPartsByPosition", params, return_type)
|
|
40
|
+
self.context.add_query(qry)
|
|
41
|
+
return return_type
|
|
42
|
+
|
|
43
|
+
def publish(self):
|
|
44
|
+
"""
|
|
45
|
+
Publish the latest version of a sitePage resource, which makes the version of the page available to all users.
|
|
46
|
+
If the page is checked out, check in the page and publish it. If the page is checked out to the caller
|
|
47
|
+
of this API, the page is automatically checked in and then published.
|
|
48
|
+
|
|
49
|
+
If a page approval flow has been activated in the page library, the page is not published until the approval
|
|
50
|
+
flow is completed.
|
|
51
|
+
"""
|
|
52
|
+
qry = ServiceOperationQuery(self, "publish")
|
|
53
|
+
self.context.add_query(qry)
|
|
54
|
+
return self
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def promotion_kind(self):
|
|
58
|
+
# type: () -> Optional[str]
|
|
59
|
+
"""Indicates the promotion kind of the sitePage."""
|
|
60
|
+
return self.properties.get("promotionKind", None)
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def show_comments(self):
|
|
64
|
+
# type: () -> Optional[bool]
|
|
65
|
+
"""Determines whether or not to show comments at the bottom of the page."""
|
|
66
|
+
return self.properties.get("showComments", None)
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def show_recommended_pages(self):
|
|
70
|
+
# type: () -> Optional[bool]
|
|
71
|
+
"""Determines whether or not to show recommended pages at the bottom of the page."""
|
|
72
|
+
return self.properties.get("showRecommendedPages", None)
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def thumbnail_web_url(self):
|
|
76
|
+
# type: () -> Optional[str]
|
|
77
|
+
"""Indicates the promotion kind of the sitePage."""
|
|
78
|
+
return self.properties.get("thumbnailWebUrl", None)
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def title_area(self):
|
|
82
|
+
# type: () -> Optional[str]
|
|
83
|
+
"""Title area on the SharePoint page."""
|
|
84
|
+
return self.properties.get("titleArea", TitleArea())
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def canvas_layout(self):
|
|
88
|
+
# type: () -> CanvasLayout
|
|
89
|
+
"""The default termStore under this site."""
|
|
90
|
+
return self.properties.get(
|
|
91
|
+
"canvasLayout",
|
|
92
|
+
CanvasLayout(
|
|
93
|
+
self.context, ResourcePath("canvasLayout", self.resource_path)
|
|
94
|
+
),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def web_parts(self):
|
|
99
|
+
# type: () -> EntityCollection[WebPart]
|
|
100
|
+
"""Collection of webparts on the SharePoint page."""
|
|
101
|
+
return self.properties.get(
|
|
102
|
+
"webParts",
|
|
103
|
+
EntityCollection(
|
|
104
|
+
self.context, WebPart, ResourcePath("webParts", self.resource_path)
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
def get_property(self, name, default_value=None):
|
|
109
|
+
if default_value is None:
|
|
110
|
+
property_mapping = {
|
|
111
|
+
"canvasLayout": self.canvas_layout,
|
|
112
|
+
"titleArea": self.title_area,
|
|
113
|
+
"webParts": self.web_parts,
|
|
114
|
+
}
|
|
115
|
+
default_value = property_mapping.get(name, None)
|
|
116
|
+
return super(SitePage, self).get_property(name, default_value)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from office365.runtime.client_value import ClientValue
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TitleArea(ClientValue):
|
|
5
|
+
"""Represents the title area of a given SharePoint page."""
|
|
6
|
+
|
|
7
|
+
def __init__(self, alternativeText=None, enableGradientEffect=None):
|
|
8
|
+
"""
|
|
9
|
+
:param str alternativeText: Alternative text on the title area.
|
|
10
|
+
:param bool enableGradientEffect: Indicates whether the title area has a gradient effect enabled.
|
|
11
|
+
"""
|
|
12
|
+
self.alternativeText = alternativeText
|
|
13
|
+
self.enableGradientEffect = enableGradientEffect
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
from office365.entity_collection import EntityCollection
|
|
3
|
+
from office365.onedrive.sitepages.web_part import WebPart
|
|
4
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class VerticalSection(Entity):
|
|
8
|
+
"""Represents the vertical section in a given SharePoint page."""
|
|
9
|
+
|
|
10
|
+
@property
|
|
11
|
+
def web_parts(self):
|
|
12
|
+
# type: () -> EntityCollection[WebPart]
|
|
13
|
+
"""The set of web parts in this section."""
|
|
14
|
+
return self.properties.get(
|
|
15
|
+
"webParts",
|
|
16
|
+
EntityCollection(
|
|
17
|
+
self.context, WebPart, ResourcePath("webParts", self.resource_path)
|
|
18
|
+
),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def get_property(self, name, default_value=None):
|
|
22
|
+
if default_value is None:
|
|
23
|
+
property_mapping = {
|
|
24
|
+
"webParts": self.web_parts,
|
|
25
|
+
}
|
|
26
|
+
default_value = property_mapping.get(name, None)
|
|
27
|
+
return super(VerticalSection, self).get_property(name, default_value)
|