Office365-REST-Python-Client 2.5.13__py3-none-any.whl → 2.5.14__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.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/METADATA +1 -1
- {Office365_REST_Python_Client-2.5.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/RECORD +135 -78
- office365/booking/business/business.py +13 -0
- office365/booking/business/collection.py +8 -4
- office365/communications/callrecords/collection.py +42 -0
- office365/communications/callrecords/direct_routing_log_row.py +5 -0
- office365/communications/cloud_communications.py +2 -3
- office365/directory/applications/application.py +16 -2
- office365/directory/applications/required_resource_access.py +23 -0
- office365/directory/applications/resource_access.py +26 -0
- office365/directory/authentication/methods/details.py +29 -0
- office365/directory/authentication/methods/root.py +8 -0
- office365/directory/permissions/scope.py +15 -3
- office365/directory/policies/authentication_strength.py +21 -0
- office365/directory/policies/update_allowed_combinations_result.py +5 -0
- office365/directory/security/alerts/evidence.py +2 -1
- office365/directory/security/alerts/malware_evidence.py +5 -0
- office365/directory/security/alerts/process_evidence.py +5 -0
- office365/directory/security/attacksimulations/user.py +5 -0
- office365/directory/security/attacksimulations/user_coverage.py +3 -0
- office365/directory/security/attacksimulations/users/details.py +6 -1
- office365/directory/serviceprincipals/service_principal.py +86 -37
- office365/onedrive/driveitems/driveItem.py +1 -1
- office365/onedrive/driveitems/retention_label.py +33 -0
- office365/onedrive/driveitems/retention_label_settings.py +7 -0
- office365/onedrive/sitepages/base.py +3 -0
- office365/onedrive/sitepages/collection.py +12 -0
- office365/onedrive/sitepages/site_page.py +9 -9
- office365/onedrive/sites/archival_details.py +5 -0
- office365/onedrive/sites/site_collection.py +10 -1
- office365/onedrive/workbooks/functions/functions.py +23 -0
- office365/partners/billing/__init__.py +0 -0
- office365/planner/tasks/check_list_item.py +5 -1
- office365/runtime/client_object.py +15 -7
- office365/runtime/client_object_collection.py +2 -2
- office365/runtime/client_result.py +2 -0
- office365/runtime/client_value.py +1 -1
- office365/runtime/csom/request.py +11 -0
- office365/runtime/types/exceptions.py +18 -0
- office365/search/acronym.py +10 -0
- office365/search/aggregation_option.py +6 -0
- office365/search/answer.py +9 -0
- office365/search/entity.py +67 -14
- office365/search/entity_type.py +28 -0
- office365/search/request.py +32 -3
- office365/sharepoint/apps/access_requests.py +5 -0
- office365/sharepoint/apps/management/__init__.py +0 -0
- office365/sharepoint/apps/management/principal_info.py +9 -0
- office365/sharepoint/authpolicy/events/collection.py +28 -0
- office365/sharepoint/authpolicy/events/role_assignment_resource_payload.py +4 -0
- office365/sharepoint/documentmanagement/document_id.py +28 -3
- office365/sharepoint/files/file.py +11 -4
- office365/sharepoint/files/versions/event.py +9 -0
- office365/sharepoint/flows/permissions.py +30 -0
- office365/sharepoint/listhome/favorite_item.py +9 -0
- office365/sharepoint/listitems/listitem.py +79 -4
- office365/sharepoint/listitems/update_parameters.py +4 -1
- office365/sharepoint/lists/data_parameters.py +5 -0
- office365/sharepoint/lists/exporter.py +73 -0
- office365/sharepoint/lists/list.py +148 -61
- office365/sharepoint/lists/render_data_parameters.py +31 -0
- office365/sharepoint/lists/version_policy_manager.py +5 -0
- office365/sharepoint/migration/copy_migration_options.py +5 -0
- office365/sharepoint/portal/groups/site_manager.py +32 -0
- office365/sharepoint/portal/project/__init__.py +9 -0
- office365/sharepoint/portal/userprofiles/documentsshared/__init__.py +0 -0
- office365/sharepoint/portal/userprofiles/documentsshared/with_group.py +38 -0
- office365/sharepoint/portal/userprofiles/documentsshared/with_person.py +9 -0
- office365/sharepoint/portal/userprofiles/sharedwithme/__init__.py +0 -0
- office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/document.py +1 -1
- office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/items.py +3 -1
- office365/sharepoint/publishing/pages/coauth_state.py +8 -0
- office365/sharepoint/publishing/pages/page.py +11 -0
- office365/sharepoint/publishing/pages/stream_content.py +9 -0
- office365/sharepoint/publishing/pages/stream_data.py +8 -0
- office365/sharepoint/quotamanagement/consumer/non_quota_backfill_api.py +8 -0
- office365/sharepoint/request.py +3 -0
- office365/sharepoint/search/administration/site_content_processing_info_provider.py +11 -0
- office365/sharepoint/search/ranking_labeling.py +1 -0
- office365/sharepoint/search/reports/abandonedqueries/__init__.py +0 -0
- office365/sharepoint/search/reports/abandonedqueries/data.py +0 -0
- office365/sharepoint/search/reports/abandonedqueries/item.py +5 -0
- office365/sharepoint/search/reports/noresult/__init__.py +0 -0
- office365/sharepoint/search/reports/numberofqueries/__init__.py +0 -0
- office365/sharepoint/search/reports/top_queries.py +7 -0
- office365/sharepoint/search/reports/topqueries/__init__.py +0 -0
- office365/sharepoint/search/reports/topqueries/data.py +9 -0
- office365/sharepoint/search/reports/topqueries/item.py +15 -0
- office365/sharepoint/search/scs_endpoint.py +9 -0
- office365/sharepoint/securestore/target_application.py +8 -0
- office365/sharepoint/sharing/document_manager.py +3 -3
- office365/sharepoint/sharing/result.py +21 -0
- office365/sharepoint/sites/html_field_security_setting.py +5 -0
- office365/sharepoint/sites/site.py +30 -1
- office365/sharepoint/sites/version_policy_manager.py +25 -0
- office365/sharepoint/sitescripts/metadata.py +28 -3
- office365/sharepoint/sitescripts/utility.py +17 -0
- office365/sharepoint/smartcache/__init__.py +0 -0
- office365/sharepoint/smartcache/item.py +9 -0
- office365/sharepoint/tenant/administration/app_billing_properties.py +21 -0
- office365/sharepoint/tenant/administration/insights/summary_response.py +8 -0
- office365/sharepoint/tenant/administration/internal/aad/__init__.py +0 -0
- office365/sharepoint/tenant/administration/internal/aad/permission_grant.py +32 -0
- office365/sharepoint/tenant/administration/internal/appservice/__init__.py +0 -0
- office365/sharepoint/tenant/administration/internal/appservice/permission_grant.py +5 -0
- office365/sharepoint/tenant/administration/internal/{permission_grant.py → appservice/permission_request.py} +4 -2
- office365/sharepoint/tenant/administration/internal/appservice/principal.py +104 -0
- office365/sharepoint/tenant/administration/settings_service.py +4 -1
- office365/sharepoint/tenant/administration/sites/creation_source.py +8 -8
- office365/sharepoint/tenant/administration/tenant.py +110 -4
- office365/sharepoint/tenant/administration/types.py +13 -1
- office365/sharepoint/tenant/cdn_api.py +3 -1
- office365/sharepoint/tenant/management/office365_tenant.py +2 -0
- office365/sharepoint/tenant/settings.py +10 -0
- office365/sharepoint/utilities/utility.py +6 -0
- office365/sharepoint/viva/connections_page.py +8 -0
- office365/sharepoint/viva/dashboard_configuration.py +8 -0
- office365/sharepoint/viva/employee_engagement.py +39 -1
- office365/sharepoint/viva/resource_get_endpoint.py +8 -0
- office365/sharepoint/viva/resource_link.py +8 -0
- office365/sharepoint/webs/information.py +66 -1
- office365/sharepoint/webs/regional_settings.py +32 -0
- office365/sharepoint/webs/templates/__init__.py +0 -0
- office365/sharepoint/webs/time_zone.py +1 -1
- office365/sharepoint/webs/web.py +58 -0
- office365/sharepoint/workflow/task.py +5 -0
- office365/subscriptions/collection.py +16 -0
- office365/sharepoint/portal/userprofiles/documents_shared_with_group.py +0 -11
- office365/sharepoint/tenant/administration/internal/web_appservice_principal.py +0 -23
- {Office365_REST_Python_Client-2.5.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/top_level.txt +0 -0
- /office365/{sharepoint/userprofiles/sharedwithme → partners}/__init__.py +0 -0
- /office365/sharepoint/portal/userprofiles/{documents_shared_with_me.py → documentsshared/with_me.py} +0 -0
- /office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/document_user.py +0 -0
- /office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/item_collection.py +0 -0
- /office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/view_item_removal_result.py +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
1
2
|
from office365.sharepoint.authpolicy.events.event import SPAuthEvent
|
|
2
3
|
from office365.sharepoint.entity_collection import EntityCollection
|
|
3
4
|
|
|
@@ -9,3 +10,30 @@ class SPAuthEventCollection(EntityCollection[SPAuthEvent]):
|
|
|
9
10
|
super(SPAuthEventCollection, self).__init__(
|
|
10
11
|
context, SPAuthEvent, resource_path, parent
|
|
11
12
|
)
|
|
13
|
+
|
|
14
|
+
def role_assignment_ms_graph_notify(
|
|
15
|
+
self, tenant, action, type_, resource_payload, id_, container_id
|
|
16
|
+
):
|
|
17
|
+
"""
|
|
18
|
+
:param str tenant:
|
|
19
|
+
:param str action:
|
|
20
|
+
:param str type_:
|
|
21
|
+
:param RoleAssignmentResourcePayload resource_payload:
|
|
22
|
+
:param str id_:
|
|
23
|
+
:param str container_id:
|
|
24
|
+
"""
|
|
25
|
+
payload = {
|
|
26
|
+
"tenant": tenant,
|
|
27
|
+
"action": action,
|
|
28
|
+
"type": type_,
|
|
29
|
+
"resourcePayload": resource_payload,
|
|
30
|
+
"id": id_,
|
|
31
|
+
"containerId": container_id,
|
|
32
|
+
}
|
|
33
|
+
return_type = SPAuthEvent(self.context)
|
|
34
|
+
self.add_child(return_type)
|
|
35
|
+
qry = ServiceOperationQuery(
|
|
36
|
+
self, "RoleAssignmentMSGraphNotify", None, payload, None, return_type
|
|
37
|
+
)
|
|
38
|
+
self.context.add_query(qry)
|
|
39
|
+
return return_type
|
|
@@ -31,22 +31,47 @@ class DocumentId(Entity):
|
|
|
31
31
|
self.context.add_query(qry)
|
|
32
32
|
return self
|
|
33
33
|
|
|
34
|
-
def
|
|
34
|
+
def reset_doc_ids_in_library(self, decoded_url, content_type_id=None):
|
|
35
35
|
"""
|
|
36
36
|
Performs the same function as ResetDocIdByServerRelativePath (section 3.1.5.10.2.1.1), but for every
|
|
37
37
|
document in the specified document library.
|
|
38
38
|
|
|
39
39
|
:param str decoded_url: Server relative path to the document library, for which all document identifiers
|
|
40
40
|
MUST be reset to guarantee global uniqueness in the farm.
|
|
41
|
-
:param str content_type_id: The content type identifier.
|
|
41
|
+
:param str or None content_type_id: The content type identifier.
|
|
42
42
|
"""
|
|
43
|
-
payload = {"
|
|
43
|
+
payload = {"decodedUrl": decoded_url, "contentTypeId": content_type_id}
|
|
44
44
|
qry = ServiceOperationQuery(
|
|
45
45
|
self, "ResetDocIdsInLibrary", None, payload, None, None
|
|
46
46
|
)
|
|
47
47
|
self.context.add_query(qry)
|
|
48
48
|
return self
|
|
49
49
|
|
|
50
|
+
def set_doc_id_site_prefix(
|
|
51
|
+
self, prefix, schedule_assignment, overwrite_existing_ids
|
|
52
|
+
):
|
|
53
|
+
"""
|
|
54
|
+
Allows to set or change the prefix used for Document IDs
|
|
55
|
+
|
|
56
|
+
:param str prefix:
|
|
57
|
+
:param bool schedule_assignment:
|
|
58
|
+
:param bool overwrite_existing_ids:
|
|
59
|
+
"""
|
|
60
|
+
payload = {
|
|
61
|
+
"prefix": prefix,
|
|
62
|
+
"scheduleAssignment": schedule_assignment,
|
|
63
|
+
"overwriteExistingIds": overwrite_existing_ids,
|
|
64
|
+
}
|
|
65
|
+
qry = ServiceOperationQuery(
|
|
66
|
+
self, "SetDocIdSitePrefix", None, payload, None, None
|
|
67
|
+
)
|
|
68
|
+
self.context.add_query(qry)
|
|
69
|
+
return self
|
|
70
|
+
|
|
50
71
|
@property
|
|
51
72
|
def entity_type_name(self):
|
|
52
73
|
return "SP.DocumentManagement.DocumentId"
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def entity_type_id(self):
|
|
77
|
+
return "fb7276a2-cd36-448b-8a60-a589205f5a8f"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
from typing import TYPE_CHECKING, AnyStr
|
|
3
|
+
from urllib.parse import quote
|
|
3
4
|
|
|
4
5
|
import requests
|
|
5
6
|
|
|
@@ -607,8 +608,11 @@ class File(AbstractFile):
|
|
|
607
608
|
:type server_relative_url: str
|
|
608
609
|
:type content: str
|
|
609
610
|
"""
|
|
610
|
-
url =
|
|
611
|
-
|
|
611
|
+
url = quote(
|
|
612
|
+
r"{0}/web/getFileByServerRelativePath(DecodedUrl='{1}')/\$value".format(
|
|
613
|
+
context.service_root_url(), server_relative_url
|
|
614
|
+
),
|
|
615
|
+
safe=":/",
|
|
612
616
|
)
|
|
613
617
|
request = RequestOptions(url)
|
|
614
618
|
request.method = HttpMethod.Post
|
|
@@ -626,8 +630,11 @@ class File(AbstractFile):
|
|
|
626
630
|
:type server_relative_url: str
|
|
627
631
|
:return Response
|
|
628
632
|
"""
|
|
629
|
-
url =
|
|
630
|
-
|
|
633
|
+
url = quote(
|
|
634
|
+
r"{0}/web/getFileByServerRelativePath(DecodedUrl='{1}')/\$value".format(
|
|
635
|
+
context.service_root_url(), server_relative_url
|
|
636
|
+
),
|
|
637
|
+
safe=":/",
|
|
631
638
|
)
|
|
632
639
|
request = RequestOptions(url)
|
|
633
640
|
request.method = HttpMethod.Get
|
|
@@ -32,3 +32,12 @@ class FileVersionEvent(Entity):
|
|
|
32
32
|
return self.properties.get(
|
|
33
33
|
"SharedWithUsers", ClientValueCollection(SharedWithUser)
|
|
34
34
|
)
|
|
35
|
+
|
|
36
|
+
def get_property(self, name, default_value=None):
|
|
37
|
+
if default_value is None:
|
|
38
|
+
property_mapping = {
|
|
39
|
+
"SharedByUser": self.shared_by_user,
|
|
40
|
+
"SharedWithUsers": self.shared_with_users,
|
|
41
|
+
}
|
|
42
|
+
default_value = property_mapping.get(name, None)
|
|
43
|
+
return super(FileVersionEvent, self).get_property(name, default_value)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from office365.runtime.client_result import ClientResult
|
|
2
|
+
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
3
|
+
from office365.sharepoint.entity import Entity
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FlowPermissions(Entity):
|
|
7
|
+
|
|
8
|
+
@staticmethod
|
|
9
|
+
def get_flow_permission_level_on_list(context, list_name):
|
|
10
|
+
"""
|
|
11
|
+
:param office365.sharepoint.client_context.ClientContext context: SharePoint client context
|
|
12
|
+
:param str list_name: Specifies the list name.
|
|
13
|
+
"""
|
|
14
|
+
return_type = ClientResult(context)
|
|
15
|
+
payload = {"listName": list_name}
|
|
16
|
+
qry = ServiceOperationQuery(
|
|
17
|
+
FlowPermissions(context),
|
|
18
|
+
"GetFlowPermissionLevelOnList",
|
|
19
|
+
None,
|
|
20
|
+
payload,
|
|
21
|
+
None,
|
|
22
|
+
return_type,
|
|
23
|
+
True,
|
|
24
|
+
)
|
|
25
|
+
context.add_query(qry)
|
|
26
|
+
return return_type
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def entity_type_name(self):
|
|
30
|
+
return "SP.Internal.FlowPermissions"
|
|
@@ -14,9 +14,11 @@ from office365.sharepoint.fields.image_value import ImageFieldValue
|
|
|
14
14
|
from office365.sharepoint.fields.lookup_value import FieldLookupValue
|
|
15
15
|
from office365.sharepoint.fields.multi_lookup_value import FieldMultiLookupValue
|
|
16
16
|
from office365.sharepoint.fields.string_values import FieldStringValues
|
|
17
|
+
from office365.sharepoint.fields.url_value import FieldUrlValue
|
|
17
18
|
from office365.sharepoint.likes.liked_by_information import LikedByInformation
|
|
18
19
|
from office365.sharepoint.listitems.compliance_info import ListItemComplianceInfo
|
|
19
20
|
from office365.sharepoint.listitems.form_update_value import ListItemFormUpdateValue
|
|
21
|
+
from office365.sharepoint.listitems.update_parameters import ListItemUpdateParameters
|
|
20
22
|
from office365.sharepoint.listitems.versions.collection import ListItemVersionCollection
|
|
21
23
|
from office365.sharepoint.permissions.securable_object import SecurableObject
|
|
22
24
|
from office365.sharepoint.policy.dlp_policy_tip import DlpPolicyTip
|
|
@@ -275,7 +277,7 @@ class ListItem(SecurableObject):
|
|
|
275
277
|
"""Validates and sets the values of the specified collection of fields for the list item.
|
|
276
278
|
|
|
277
279
|
:param dict form_values: Specifies a collection of field internal names and values for the given field
|
|
278
|
-
:param
|
|
280
|
+
:param bool new_document_update: Specifies whether the list item is a document being updated after upload.
|
|
279
281
|
:param str checkin_comment: Check-in comment, if any. This parameter is only applicable when the list item
|
|
280
282
|
is checked out.
|
|
281
283
|
:param bool or None dates_in_utc:
|
|
@@ -310,10 +312,59 @@ class ListItem(SecurableObject):
|
|
|
310
312
|
super(ListItem, self).update()
|
|
311
313
|
return self
|
|
312
314
|
|
|
315
|
+
def update_ex(self, bypass_quota_check=None, bypass_shared_lock=None):
|
|
316
|
+
"""
|
|
317
|
+
|
|
318
|
+
:param bool bypass_quota_check:
|
|
319
|
+
:param bool bypass_shared_lock:
|
|
320
|
+
"""
|
|
321
|
+
payload = {
|
|
322
|
+
"parameters": ListItemUpdateParameters(
|
|
323
|
+
bypass_quota_check, bypass_shared_lock
|
|
324
|
+
)
|
|
325
|
+
}
|
|
326
|
+
qry = ServiceOperationQuery(self, "UpdateEx", None, payload)
|
|
327
|
+
self.context.add_query(qry)
|
|
328
|
+
return self
|
|
329
|
+
|
|
313
330
|
def system_update(self):
|
|
314
331
|
"""Update the list item."""
|
|
315
|
-
|
|
316
|
-
|
|
332
|
+
|
|
333
|
+
sys_metadata = ["EditorId", "Modified"]
|
|
334
|
+
|
|
335
|
+
def _after_system_update(result):
|
|
336
|
+
# type: (ClientResult[ClientValueCollection[ListItemFormUpdateValue]]) -> None
|
|
337
|
+
has_any_error = any([item.HasException for item in result.value])
|
|
338
|
+
if has_any_error:
|
|
339
|
+
raise ValueError("Update ListItem failed")
|
|
340
|
+
|
|
341
|
+
def _system_update():
|
|
342
|
+
from office365.sharepoint.fields.user_value import FieldUserValue
|
|
343
|
+
|
|
344
|
+
form_values = self.persistable_properties
|
|
345
|
+
for n in sys_metadata:
|
|
346
|
+
if n == "Id":
|
|
347
|
+
pass
|
|
348
|
+
elif n.endswith("Id"):
|
|
349
|
+
user = self.context.web.site_users.get_by_id(self.get_property(n))
|
|
350
|
+
form_values[n[:-2]] = FieldUserValue.from_user(user)
|
|
351
|
+
else:
|
|
352
|
+
form_values[n] = self.get_property(n)
|
|
353
|
+
|
|
354
|
+
self.validate_update_list_item(
|
|
355
|
+
form_values=form_values,
|
|
356
|
+
dates_in_utc=True,
|
|
357
|
+
new_document_update=True,
|
|
358
|
+
).after_execute(_after_system_update)
|
|
359
|
+
|
|
360
|
+
def _list_loaded():
|
|
361
|
+
if self.parent_list.base_template == 101:
|
|
362
|
+
self.ensure_properties(sys_metadata, _system_update)
|
|
363
|
+
else:
|
|
364
|
+
next_qry = ServiceOperationQuery(self, "SystemUpdate")
|
|
365
|
+
self.context.add_query(next_qry)
|
|
366
|
+
|
|
367
|
+
self.parent_list.ensure_properties(["BaseTemplate"], _list_loaded)
|
|
317
368
|
return self
|
|
318
369
|
|
|
319
370
|
def update_overwrite_version(self):
|
|
@@ -332,6 +383,17 @@ class ListItem(SecurableObject):
|
|
|
332
383
|
self.context.add_query(qry)
|
|
333
384
|
return self
|
|
334
385
|
|
|
386
|
+
def set_compliance_tag_with_hold(self, compliance_tag):
|
|
387
|
+
"""
|
|
388
|
+
Sets a compliance tag with a hold
|
|
389
|
+
|
|
390
|
+
:param str compliance_tag: The applying label (tag) to the list item
|
|
391
|
+
"""
|
|
392
|
+
payload = {"complianceTag": compliance_tag}
|
|
393
|
+
qry = ServiceOperationQuery(self, "SetComplianceTagWithHold", None, payload)
|
|
394
|
+
self.context.add_query(qry)
|
|
395
|
+
return self
|
|
396
|
+
|
|
335
397
|
def get_comments(self):
|
|
336
398
|
"""Retrieve ListItem comments"""
|
|
337
399
|
return_type = CommentCollection(self.context)
|
|
@@ -377,7 +439,7 @@ class ListItem(SecurableObject):
|
|
|
377
439
|
"""Get parent List"""
|
|
378
440
|
from office365.sharepoint.lists.list import List
|
|
379
441
|
|
|
380
|
-
return self.properties.
|
|
442
|
+
return self.properties.setdefault(
|
|
381
443
|
"ParentList",
|
|
382
444
|
List(self.context, ResourcePath("ParentList", self.resource_path)),
|
|
383
445
|
)
|
|
@@ -507,12 +569,25 @@ class ListItem(SecurableObject):
|
|
|
507
569
|
),
|
|
508
570
|
)
|
|
509
571
|
|
|
572
|
+
@property
|
|
573
|
+
def doc_id(self):
|
|
574
|
+
# type: () -> Optional[str]
|
|
575
|
+
"""Document ID fora document"""
|
|
576
|
+
return self.properties.get("OData__dlc_DocId", None)
|
|
577
|
+
|
|
578
|
+
@property
|
|
579
|
+
def doc_id_url(self):
|
|
580
|
+
# type: () -> Optional[FieldUrlValue]
|
|
581
|
+
"""Document ID fora document"""
|
|
582
|
+
return self.properties.get("OData__dlc_DocIdUrl", FieldUrlValue())
|
|
583
|
+
|
|
510
584
|
def get_property(self, name, default_value=None):
|
|
511
585
|
if default_value is None:
|
|
512
586
|
property_mapping = {
|
|
513
587
|
"AttachmentFiles": self.attachment_files,
|
|
514
588
|
"ContentType": self.content_type,
|
|
515
589
|
"ComplianceInfo": self.compliance_info,
|
|
590
|
+
"OData__dlc_DocIdUrl": self.doc_id_url,
|
|
516
591
|
"EffectiveBasePermissions": self.effective_base_permissions,
|
|
517
592
|
"GetDlpPolicyTip": self.get_dlp_policy_tip,
|
|
518
593
|
"FieldValuesAsHtml": self.field_values_as_html,
|
|
@@ -2,4 +2,7 @@ from office365.runtime.client_value import ClientValue
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class ListItemUpdateParameters(ClientValue):
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
def __init__(self, bypass_quota_check=None, bypass_shared_lock=None):
|
|
7
|
+
self.BypassQuotaCheck = bypass_quota_check
|
|
8
|
+
self.BypassSharedLock = bypass_shared_lock
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import IO, AnyStr, Callable
|
|
3
|
+
|
|
4
|
+
from typing_extensions import Self
|
|
5
|
+
|
|
6
|
+
from office365.runtime.client_result import ClientResult
|
|
7
|
+
from office365.sharepoint.files.system_object_type import FileSystemObjectType
|
|
8
|
+
from office365.sharepoint.listitems.collection import ListItemCollection
|
|
9
|
+
from office365.sharepoint.listitems.listitem import ListItem
|
|
10
|
+
from office365.sharepoint.lists.list import List
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ListExporter(object):
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def export(
|
|
17
|
+
source_list, destination_file, include_content=False, item_exported=None
|
|
18
|
+
):
|
|
19
|
+
# type: (List, IO, bool, Callable[[ListItem], None]) -> Self
|
|
20
|
+
"""Exports SharePoint List"""
|
|
21
|
+
import zipfile
|
|
22
|
+
|
|
23
|
+
def _append_file(name, data):
|
|
24
|
+
with zipfile.ZipFile(
|
|
25
|
+
destination_file.name, "a", zipfile.ZIP_DEFLATED
|
|
26
|
+
) as zf:
|
|
27
|
+
zf.writestr(name, data)
|
|
28
|
+
|
|
29
|
+
def _download_content(list_item):
|
|
30
|
+
# type: (ListItem) -> None
|
|
31
|
+
def _after_downloaded(result):
|
|
32
|
+
# type: (ClientResult[AnyStr]) -> None
|
|
33
|
+
item_path = list_item.properties["FileRef"].replace(
|
|
34
|
+
source_list.root_folder.serverRelativeUrl, ""
|
|
35
|
+
)
|
|
36
|
+
_append_file(item_path, result.value)
|
|
37
|
+
|
|
38
|
+
list_item.file.get_content().after_execute(_after_downloaded)
|
|
39
|
+
|
|
40
|
+
def _export_items(items):
|
|
41
|
+
# type: (ListItemCollection) -> None
|
|
42
|
+
|
|
43
|
+
for item in items:
|
|
44
|
+
item_path = str(item.id) + ".json"
|
|
45
|
+
|
|
46
|
+
if item.file_system_object_type == FileSystemObjectType.File:
|
|
47
|
+
_append_file(item_path, json.dumps(item.to_json()))
|
|
48
|
+
|
|
49
|
+
if include_content:
|
|
50
|
+
_download_content(item)
|
|
51
|
+
|
|
52
|
+
if callable(item_exported):
|
|
53
|
+
item_exported(item)
|
|
54
|
+
|
|
55
|
+
def _get_items():
|
|
56
|
+
(
|
|
57
|
+
source_list.items.select(
|
|
58
|
+
[
|
|
59
|
+
"*",
|
|
60
|
+
"Id",
|
|
61
|
+
"FileRef",
|
|
62
|
+
"FileDirRef",
|
|
63
|
+
"FileLeafRef",
|
|
64
|
+
"FileSystemObjectType",
|
|
65
|
+
]
|
|
66
|
+
)
|
|
67
|
+
.get()
|
|
68
|
+
.paged(page_loaded=_export_items)
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
source_list.ensure_properties(["SchemaXml", "RootFolder"], _get_items)
|
|
72
|
+
|
|
73
|
+
return source_list
|