Office365-REST-Python-Client 3.1.0__py3-none-any.whl → 3.2.0__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.
Files changed (245) hide show
  1. office365/communications/callrecords/call_record.py +18 -0
  2. office365/communications/calls/call.py +3 -0
  3. office365/communications/presences/presence.py +3 -0
  4. office365/communications/quotas.py +66 -0
  5. office365/communications/virtualevents/virtual_event.py +3 -0
  6. office365/directory/domains/domain.py +3 -0
  7. office365/directory/licenses/subscribed_sku.py +3 -0
  8. office365/directory/objects/object.py +3 -0
  9. office365/directory/quotas.py +34 -0
  10. office365/entity_collection.py +2 -2
  11. office365/graph_client.py +46 -2
  12. office365/limits.py +66 -0
  13. office365/migration/__init__.py +6 -1
  14. office365/migration/adapters/__init__.py +14 -4
  15. office365/migration/adapters/filesystem.py +4 -1
  16. office365/migration/assessment/export.py +5 -5
  17. office365/migration/assessment/issue.py +19 -0
  18. office365/migration/assessment/report.py +11 -0
  19. office365/migration/assessment/scanners/base.py +37 -49
  20. office365/migration/base.py +33 -8
  21. office365/migration/checkpoint.py +1 -1
  22. office365/migration/outlook/assessor.py +4 -4
  23. office365/migration/package/__init__.py +82 -0
  24. office365/migration/package/builder.py +603 -0
  25. office365/migration/package/crypto.py +54 -0
  26. office365/migration/package/manifest_xml.py +495 -0
  27. office365/migration/package/staging.py +180 -0
  28. office365/migration/report.py +7 -2
  29. office365/migration/report_io.py +79 -0
  30. office365/migration/runner.py +117 -10
  31. office365/migration/server_job.py +126 -14
  32. office365/migration/session.py +132 -49
  33. office365/migration/settings.py +67 -0
  34. office365/migration/sharepoint/__init__.py +2 -0
  35. office365/migration/sharepoint/adapters.py +207 -41
  36. office365/migration/sharepoint/assessor.py +45 -9
  37. office365/migration/sharepoint/options.py +57 -0
  38. office365/migration/sharepoint/package_target.py +209 -0
  39. office365/migration/sharepoint/registry.py +22 -0
  40. office365/migration/sharepoint/resolvers.py +96 -0
  41. office365/migration/sharepoint/scanners/__init__.py +29 -0
  42. office365/migration/sharepoint/scanners/browser_file_handling.py +55 -0
  43. office365/migration/sharepoint/scanners/checked_out_files.py +57 -0
  44. office365/migration/sharepoint/scanners/file_versions.py +56 -0
  45. office365/migration/sharepoint/scanners/files.py +5 -2
  46. office365/migration/sharepoint/scanners/large_excel_files.py +56 -0
  47. office365/migration/sharepoint/scanners/large_lists.py +58 -0
  48. office365/migration/sharepoint/scanners/large_sites.py +4 -3
  49. office365/migration/sharepoint/scanners/long_onedrive_urls.py +52 -0
  50. office365/migration/sharepoint/scanners/lookup.py +38 -0
  51. office365/migration/sharepoint/scanners/paths.py +9 -4
  52. office365/migration/sharepoint/scanners/permissions.py +20 -2
  53. office365/migration/sharepoint/scanners/smat.py +51 -0
  54. office365/migration/sharepoint/scanners/summary.py +1 -0
  55. office365/migration/sharepoint/scanners/thicket_folders.py +38 -0
  56. office365/migration/sharepoint/scanners/unsupported_site_templates.py +90 -0
  57. office365/migration/sharepoint/tenant_assessor.py +5 -3
  58. office365/migration/sharepoint/transfer.py +4 -2
  59. office365/migration/tasks.py +121 -0
  60. office365/migration/validators.py +2 -19
  61. office365/onedrive/driveitems/driveItem.py +116 -12
  62. office365/onedrive/termstore/groups/collection.py +2 -9
  63. office365/onedrive/termstore/sets/collection.py +2 -9
  64. office365/onedrive/termstore/terms/collection.py +3 -10
  65. office365/onedrive/workbooks/workbook.py +7 -0
  66. office365/outlook/contacts/folders/collection.py +4 -13
  67. office365/runtime/auth/authentication_context.py +5 -0
  68. office365/runtime/client_object.py +18 -0
  69. office365/runtime/client_object_collection.py +75 -245
  70. office365/runtime/client_request.py +77 -1
  71. office365/runtime/client_request_exception.py +127 -39
  72. office365/runtime/client_runtime_context.py +79 -8
  73. office365/runtime/converters/csv_writer.py +10 -4
  74. office365/runtime/converters/dataframe.py +84 -4
  75. office365/runtime/converters/json_file.py +12 -3
  76. office365/runtime/converters/parquet.py +67 -0
  77. office365/runtime/converters/records.py +31 -12
  78. office365/runtime/converters/registry.py +185 -0
  79. office365/runtime/converters/scalars.py +31 -0
  80. office365/runtime/converters/sql.py +69 -0
  81. office365/runtime/converters/streamers.py +105 -0
  82. office365/runtime/converters/streams.py +42 -0
  83. office365/runtime/converters/upsert.py +101 -0
  84. office365/runtime/exceptions.py +105 -0
  85. office365/runtime/http/prefer.py +26 -0
  86. office365/runtime/http/throttling.py +258 -56
  87. office365/runtime/imports.py +571 -0
  88. office365/runtime/limits.py +455 -0
  89. office365/runtime/odata/request.py +11 -2
  90. office365/runtime/odata/type.py +1 -0
  91. office365/runtime/odata/v3/batch_request.py +4 -2
  92. office365/runtime/odata/v4/batch_request.py +22 -7
  93. office365/runtime/operations.py +29 -0
  94. office365/runtime/parallel.py +12 -14
  95. office365/runtime/paths/v4/entity.py +2 -2
  96. office365/runtime/queries/batch.py +18 -1
  97. office365/runtime/queries/get_or_create.py +109 -0
  98. office365/runtime/record_collection.py +443 -0
  99. office365/runtime/retry.py +92 -26
  100. office365/runtime/transport/base.py +6 -1
  101. office365/runtime/transport/requests_transport.py +4 -0
  102. office365/runtime/transport/throttled_transport.py +67 -0
  103. office365/runtime/verification.py +40 -0
  104. office365/sharepoint/activities/logger.py +118 -8
  105. office365/sharepoint/administration/analytics/usage_service.py +15 -7
  106. office365/sharepoint/administration/sitemove/service.py +791 -8
  107. office365/sharepoint/alerts/alert.py +79 -0
  108. office365/sharepoint/apps/app_collection.py +25 -0
  109. office365/sharepoint/apps/launcher.py +16 -0
  110. office365/sharepoint/authpolicy/tenant/compliancereport.py +5 -0
  111. office365/sharepoint/businessdata/app_bdc_catalog.py +135 -0
  112. office365/sharepoint/businessdata/entityfieldvaluedictionary.py +65 -0
  113. office365/sharepoint/businessdata/entityidentifier.py +23 -0
  114. office365/sharepoint/businessdata/entityinstance.py +52 -0
  115. office365/sharepoint/businessdata/entityview.py +31 -0
  116. office365/sharepoint/businessdata/externalsubscriptionstore.py +9 -0
  117. office365/sharepoint/businessdata/typedescriptor.py +37 -0
  118. office365/sharepoint/client_context.py +40 -23
  119. office365/sharepoint/clientsidecomponent/hostedapps/app.py +21 -0
  120. office365/sharepoint/clientsidecomponent/hostedapps/manager.py +16 -0
  121. office365/sharepoint/comments/comment.py +84 -2
  122. office365/sharepoint/contentcenter/machinelearning/models/model.py +0 -23
  123. office365/sharepoint/contentcenter/machinelearning/publications/publication.py +0 -9
  124. office365/sharepoint/contentcenter/machinelearning/samples/sample.py +0 -14
  125. office365/sharepoint/contentcenter/machinelearning/workitems/item.py +0 -80
  126. office365/sharepoint/contentsolution/template_api.py +148 -0
  127. office365/sharepoint/contenttypes/collection.py +32 -10
  128. office365/sharepoint/convergence/addnoliveblobsinodcservicestateapi.py +9 -0
  129. office365/sharepoint/convergence/consumer_permissions.py +15 -0
  130. office365/sharepoint/convergence/migration_complete_state_api.py +25 -0
  131. office365/sharepoint/convergence/odcmetadatacleanedupapi.py +9 -0
  132. office365/sharepoint/documentmanagement/document_id.py +12 -0
  133. office365/sharepoint/entity.py +11 -2
  134. office365/sharepoint/entity_collection.py +2 -2
  135. office365/sharepoint/exceptions.py +194 -0
  136. office365/sharepoint/fields/builtin_field_id.py +45 -34
  137. office365/sharepoint/fields/builtin_field_name.py +123 -0
  138. office365/sharepoint/fields/coercion.py +131 -0
  139. office365/sharepoint/fields/collection.py +54 -37
  140. office365/sharepoint/fields/field.py +17 -0
  141. office365/sharepoint/fields/name.py +46 -2
  142. office365/sharepoint/files/collection.py +7 -1
  143. office365/sharepoint/files/file.py +54 -8
  144. office365/sharepoint/files/versions/version.py +38 -13
  145. office365/sharepoint/folders/collection.py +4 -0
  146. office365/sharepoint/folders/folder.py +91 -21
  147. office365/sharepoint/htmlpages/html_page.py +16 -0
  148. office365/sharepoint/htmlpages/html_page_service.py +19 -0
  149. office365/sharepoint/ir/migration.py +9 -0
  150. office365/sharepoint/listitems/caml/__init__.py +31 -0
  151. office365/sharepoint/listitems/caml/builder.py +129 -0
  152. office365/sharepoint/listitems/caml/expressions.py +424 -0
  153. office365/sharepoint/listitems/caml/fields.py +68 -0
  154. office365/sharepoint/listitems/caml/guard.py +63 -0
  155. office365/sharepoint/listitems/caml/query.py +71 -2
  156. office365/sharepoint/listitems/caml/values.py +113 -0
  157. office365/sharepoint/listitems/collection.py +21 -20
  158. office365/sharepoint/listitems/upsert.py +75 -0
  159. office365/sharepoint/lists/collection.py +29 -22
  160. office365/sharepoint/lists/exporter.py +4 -3
  161. office365/sharepoint/lists/list.py +397 -39
  162. office365/sharepoint/lists/smart_wiki_library_utility.py +58 -0
  163. office365/sharepoint/logger/export.py +12 -0
  164. office365/sharepoint/marketplace/app_metadata.py +97 -1
  165. office365/sharepoint/marketplace/appstatequeryjobdefinition.py +9 -0
  166. office365/sharepoint/marketplace/corporatecuratedgallery/carddesigns/card_designs.py +35 -0
  167. office365/sharepoint/marketplace/sitecollection/appcatalog/allowed_item.py +5 -0
  168. office365/sharepoint/marketplace/tenant/appcatalog/accessor.py +107 -30
  169. office365/sharepoint/microfeed/data.py +0 -6
  170. office365/sharepoint/microservice/manager.py +61 -0
  171. office365/sharepoint/migrationcenter/common/task.py +193 -4
  172. office365/sharepoint/migrationcenter/common/task_entity_data.py +1 -1
  173. office365/sharepoint/migrationcenter/deploy_status.py +13 -0
  174. office365/sharepoint/migrationcenter/service/properties.py +20 -0
  175. office365/sharepoint/migrationcenter/service/storage.py +34 -0
  176. office365/sharepoint/migrationcenter/spflight.py +13 -0
  177. office365/sharepoint/migrationcenter/urlparseresult.py +77 -0
  178. office365/sharepoint/multigeo/service/spmultigeoproxy.py +13 -0
  179. office365/sharepoint/navigation/servicerest.py +127 -0
  180. office365/sharepoint/oauth/authentication.py +13 -0
  181. office365/sharepoint/portal/theme_manager.py +120 -8
  182. office365/sharepoint/principal/users/user.py +10 -0
  183. office365/sharepoint/publishing/campaign/campaign.py +36 -1
  184. office365/sharepoint/publishing/feedvideopage.py +0 -7
  185. office365/sharepoint/publishing/pages/3d/page.py +0 -6
  186. office365/sharepoint/publishing/pages/page.py +0 -117
  187. office365/sharepoint/publishing/pages/reposts/repost.py +0 -7
  188. office365/sharepoint/publishing/pages/topics/topic.py +0 -7
  189. office365/sharepoint/publishing/subtitlefile.py +0 -40
  190. office365/sharepoint/quotamanagement/consumer/consumer_quota_info_api.py +14 -0
  191. office365/sharepoint/quotamanagement/consumer/non_quota_backfill_api.py +23 -0
  192. office365/sharepoint/quotamanagement/consumer/nonquotamigrationapi.py +9 -0
  193. office365/sharepoint/quotamanagement/consumer/quotamigrationapi.py +13 -0
  194. office365/sharepoint/request.py +57 -16
  195. office365/sharepoint/search/administration/document_crawl_log.py +24 -7
  196. office365/sharepoint/search/administration/providers/crawl_versions_info.py +29 -0
  197. office365/sharepoint/search/administration/providers/recycle_bin_info.py +23 -0
  198. office365/sharepoint/search/administration/providers/site_content_processing_info.py +67 -0
  199. office365/sharepoint/sites/site.py +976 -65
  200. office365/sharepoint/sites/siteprovisioninginfoprovider.py +13 -0
  201. office365/sharepoint/tenant/administration/datagovernance/insight_client.py +292 -23
  202. office365/sharepoint/tenant/administration/ddiadapter.py +97 -0
  203. office365/sharepoint/tenant/administration/internal/aad/collection.py +20 -0
  204. office365/sharepoint/tenant/administration/internal/aad/permission_grant.py +0 -19
  205. office365/sharepoint/tenant/administration/internal/appservice/permission_request.py +72 -1
  206. office365/sharepoint/tenant/administration/internal/appservice/principal.py +1 -3
  207. office365/sharepoint/tenant/administration/odb_license_enforcement_service.py +26 -0
  208. office365/sharepoint/tenant/administration/sites/properties.py +564 -6
  209. office365/sharepoint/tenant/administration/spdatagovernancesarrestapiclient.py +60 -1
  210. office365/sharepoint/tenant/insights/reports/manager.py +24 -12
  211. office365/sharepoint/tenant/management/office365_tenant.py +451 -2
  212. office365/sharepoint/tenantadministration/catalog_management_collection.py +69 -0
  213. office365/sharepoint/tenantadministration/catalog_management_custom_properties_collection.py +237 -0
  214. office365/sharepoint/tenantadministration/catalog_management_restricted_content_discovery_collection.py +56 -0
  215. office365/sharepoint/tenantadministration/sp_data_governance_client_exception.py +7 -0
  216. office365/sharepoint/thresholds.py +529 -0
  217. office365/sharepoint/translation/jobs/job.py +72 -2
  218. office365/sharepoint/translation/jobs/status.py +47 -9
  219. office365/sharepoint/translation/sync_translator.py +15 -2
  220. office365/sharepoint/utilities/move_copy_util.py +2 -1
  221. office365/sharepoint/viva/connections/page.py +27 -0
  222. office365/sharepoint/viva/home.py +38 -0
  223. office365/sharepoint/viva/learningmanager.py +9 -0
  224. office365/sharepoint/viva/vivaresources.py +60 -0
  225. office365/sharepoint/webhooks/subscription.py +0 -11
  226. office365/sharepoint/webparts/definitions/definition.py +13 -0
  227. office365/sharepoint/webparts/limited_manager.py +29 -7
  228. office365/sharepoint/webs/context_web_information.py +14 -9
  229. office365/sharepoint/webs/templates/__init__.py +11 -0
  230. office365/sharepoint/webs/templates/type.py +74 -15
  231. office365/sharepoint/workflow/definition.py +6 -0
  232. office365/sharepoint/workflow/deployment_service.py +155 -0
  233. office365/sharepoint/workflow/instances/service.py +33 -0
  234. office365/sharepoint/workflow/interopservice.py +68 -0
  235. office365/sharepoint/workflow/messagingservice.py +24 -0
  236. office365/sharepoint/workflow/servicesmanager.py +41 -2
  237. office365/sharepoint/workflow/subscriptions/service.py +67 -0
  238. office365/sharepoint/workflow/subscriptions/subscription.py +31 -0
  239. office365/sharepoint/workflow/task.py +425 -0
  240. office365_rest_python_client-3.2.0.dist-info/METADATA +605 -0
  241. {office365_rest_python_client-3.1.0.dist-info → office365_rest_python_client-3.2.0.dist-info}/RECORD +242 -185
  242. office365/migration/_util.py +0 -73
  243. office365/sharepoint/listitems/caml/types.py +0 -70
  244. office365_rest_python_client-3.1.0.dist-info/METADATA +0 -475
  245. {office365_rest_python_client-3.1.0.dist-info → office365_rest_python_client-3.2.0.dist-info}/WHEEL +0 -0
@@ -1,3 +1,6 @@
1
+ from typing_extensions import Self
2
+
3
+ from office365.runtime.queries.service_operation import ServiceOperationQuery
1
4
  from office365.sharepoint.entity import Entity
2
5
 
3
6
 
@@ -5,3 +8,9 @@ class AddNoLiveBlobsInOdcServiceStateApi(Entity):
5
8
  @property
6
9
  def entity_type_name(self) -> str:
7
10
  return "Microsoft.SharePoint.Convergence.AddNoLiveBlobsInOdcServiceStateApi"
11
+
12
+ def add_state(self) -> Self:
13
+ """AddState operation."""
14
+ qry = ServiceOperationQuery(self, "AddState", None, {}, None, None)
15
+ self.context.add_query(qry)
16
+ return self
@@ -1,4 +1,7 @@
1
+ from typing_extensions import Self
2
+
1
3
  from office365.runtime.paths.resource_path import ResourcePath
4
+ from office365.runtime.queries.service_operation import ServiceOperationQuery
2
5
  from office365.sharepoint.entity import Entity
3
6
 
4
7
 
@@ -11,3 +14,15 @@ class ConsumerPermissions(Entity):
11
14
  @property
12
15
  def entity_type_name(self):
13
16
  return "Microsoft.SharePoint.Convergence.ConsumerPermissions"
17
+
18
+ def grant_consumer_site_permissions(self) -> Self:
19
+ """GrantConsumerSitePermissions operation."""
20
+ qry = ServiceOperationQuery(self, "GrantConsumerSitePermissions", None, {}, None, None)
21
+ self.context.add_query(qry)
22
+ return self
23
+
24
+ def revoke_consumer_site_permissions(self) -> Self:
25
+ """RevokeConsumerSitePermissions operation."""
26
+ qry = ServiceOperationQuery(self, "RevokeConsumerSitePermissions", None, {}, None, None)
27
+ self.context.add_query(qry)
28
+ return self
@@ -1,3 +1,8 @@
1
+ from typing_extensions import Self
2
+
3
+ from office365.runtime.client_result import ClientResult
4
+ from office365.runtime.queries.function import FunctionQuery
5
+ from office365.runtime.queries.service_operation import ServiceOperationQuery
1
6
  from office365.sharepoint.entity import Entity
2
7
 
3
8
 
@@ -7,3 +12,23 @@ class MigrationCompleteStateApi(Entity):
7
12
  @property
8
13
  def entity_type_name(self):
9
14
  return "Microsoft.SharePoint.Convergence.MigrationCompleteStateApi"
15
+
16
+ def add_state(self) -> Self:
17
+ """AddState operation."""
18
+ qry = ServiceOperationQuery(self, "AddState", None, {}, None, None)
19
+ self.context.add_query(qry)
20
+ return self
21
+
22
+ def is_doclib_contributor_owner_enabled(self) -> ClientResult[bool]:
23
+ """IsDoclibContributorOwnerEnabled operation."""
24
+ return_type = ClientResult(self.context, bool())
25
+ qry = FunctionQuery(self, "IsDoclibContributorOwnerEnabled", [], return_type)
26
+ self.context.add_query(qry)
27
+ return return_type
28
+
29
+ def is_suspended(self) -> ClientResult[bool]:
30
+ """IsSuspended operation."""
31
+ return_type = ClientResult(self.context, bool())
32
+ qry = FunctionQuery(self, "IsSuspended", [], return_type)
33
+ self.context.add_query(qry)
34
+ return return_type
@@ -1,3 +1,6 @@
1
+ from typing_extensions import Self
2
+
3
+ from office365.runtime.queries.service_operation import ServiceOperationQuery
1
4
  from office365.sharepoint.entity import Entity
2
5
 
3
6
 
@@ -5,3 +8,9 @@ class OdcMetadataCleanedUpApi(Entity):
5
8
  @property
6
9
  def entity_type_name(self) -> str:
7
10
  return "Microsoft.SharePoint.Convergence.OdcMetadataCleanedUpApi"
11
+
12
+ def add_state(self) -> Self:
13
+ """AddState operation."""
14
+ qry = ServiceOperationQuery(self, "AddState", None, {}, None, None)
15
+ self.context.add_query(qry)
16
+ return self
@@ -73,3 +73,15 @@ class DocumentId(Entity):
73
73
  @property
74
74
  def entity_type_id(self):
75
75
  return "fb7276a2-cd36-448b-8a60-a589205f5a8f"
76
+
77
+ def reset_doc_id_by_server_relative_path(self, decoded_url: str) -> Self:
78
+ """ResetDocIdByServerRelativePath operation.
79
+
80
+ Args:
81
+ decoded_url (str): DecodedUrl parameter
82
+ """
83
+ qry = ServiceOperationQuery(
84
+ self, "ResetDocIdByServerRelativePath", None, {"DecodedUrl": decoded_url}, None, None
85
+ )
86
+ self.context.add_query(qry)
87
+ return self
@@ -12,6 +12,7 @@ from office365.runtime.http.url import get_absolute_url
12
12
  from office365.runtime.paths.v3.entity import EntityPath
13
13
  from office365.runtime.queries.delete_entity import DeleteEntityQuery
14
14
  from office365.runtime.queries.update_entity import UpdateEntityQuery
15
+ from office365.sharepoint.thresholds import Limits, limit
15
16
 
16
17
  if TYPE_CHECKING:
17
18
  from office365.sharepoint.client_context import ClientContext
@@ -35,11 +36,13 @@ class Entity(ClientObject):
35
36
  self.context.execute_query_with_incremental_retry(max_retry, max_delay=max_delay, jitter=jitter)
36
37
  return self
37
38
 
39
+ @limit(Limits.BATCH_ITEMS, arg="items_per_batch")
38
40
  def execute_batch(
39
41
  self,
40
- items_per_batch: int = 100,
42
+ items_per_batch: int = Limits.BATCH_ITEMS.value,
41
43
  success_callback: Optional[Callable[[List[Union[ClientObject, ClientResult]]], None]] = None,
42
44
  max_batch_bytes: Optional[int] = None,
45
+ concurrency: int = 1,
43
46
  ) -> Self:
44
47
  """
45
48
  Construct and submit a batch request to the server
@@ -48,11 +51,17 @@ class Entity(ClientObject):
48
51
  items_per_batch: Number of items per batch (default: 100)
49
52
  success_callback: Callback function for successful batch execution
50
53
  max_batch_bytes: Maximum estimated batch payload size in bytes
54
+ concurrency: Maximum number of concurrent batch requests (default 1)
51
55
 
52
56
  Returns:
53
57
  self: Supports method chaining
54
58
  """
55
- self.context.execute_batch(items_per_batch, success_callback, max_batch_bytes=max_batch_bytes)
59
+ self.context.execute_batch(
60
+ items_per_batch,
61
+ success_callback,
62
+ concurrency=concurrency,
63
+ max_batch_bytes=max_batch_bytes,
64
+ )
56
65
  return self
57
66
 
58
67
  def with_credentials(self, credentials: Union[UserCredential, ClientCredential]) -> Self:
@@ -3,16 +3,16 @@ from __future__ import annotations
3
3
  from typing import TYPE_CHECKING, Optional, Type, cast
4
4
 
5
5
  from office365.runtime.client_object import ClientObjectT
6
- from office365.runtime.client_object_collection import ClientObjectCollection
7
6
  from office365.runtime.paths.resource_path import ResourcePath
8
7
  from office365.runtime.paths.v3.entity import EntityPath
8
+ from office365.runtime.record_collection import RecordCollection
9
9
  from office365.sharepoint.entity import Entity
10
10
 
11
11
  if TYPE_CHECKING:
12
12
  from office365.sharepoint.client_context import ClientContext
13
13
 
14
14
 
15
- class EntityCollection(ClientObjectCollection[ClientObjectT]):
15
+ class EntityCollection(RecordCollection[ClientObjectT]):
16
16
  """A type-safe collection of SharePoint entities.
17
17
 
18
18
  Provides strongly-typed access to SharePoint entity collections with support for:
@@ -0,0 +1,194 @@
1
+ """SharePoint-specific request exceptions.
2
+
3
+ These self-register with
4
+ :func:`~office365.runtime.client_request_exception.register_error_type` so the
5
+ product-agnostic dispatcher in the runtime can classify SharePoint error
6
+ responses without importing this package.
7
+
8
+ Classification never matches translated messages: SharePoint encodes the error
9
+ as ``"<HRESULT>, <dotnet-type>"`` (e.g. ``"-2130575169,
10
+ Microsoft.SharePoint.SPDuplicateValuesFoundException"``), so the concrete types
11
+ below key off the numeric code and/or the embedded .NET type name — both locale
12
+ independent. Any remaining ``Microsoft.SharePoint.*`` error is caught by
13
+ :class:`SharePointException`.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ from office365.runtime.client_request_exception import (
19
+ ClientRequestException,
20
+ ErrorPayload,
21
+ register_error_type,
22
+ )
23
+ from office365.runtime.exceptions import FileLockedException
24
+ from office365.sharepoint.thresholds import LIST_VIEW_THRESHOLD, SAFE_PAGE_SIZE
25
+
26
+ #: SharePoint-flavoured alias of :class:`~office365.runtime.exceptions.FileLockedException`.
27
+ #: Raised when a file is open for coauthoring (HTTP 423 /
28
+ #: ``Microsoft.SharePoint.SPFileLockException``) and therefore cannot be
29
+ #: overwritten. See ``FileLockedException.GUIDANCE`` for the available options.
30
+ SPFileLockedException = FileLockedException
31
+
32
+
33
+ class SharePointException(ClientRequestException):
34
+ """Base class for SharePoint server exceptions (``Microsoft.SharePoint.*``).
35
+
36
+ Serves as a catch-all so callers can ``except SharePointException`` for any
37
+ otherwise-unclassified SharePoint error. Concrete subclasses set
38
+ :attr:`_HRESULTS` and/or :attr:`_TYPE_NAMES`; they are picked over this base
39
+ by :attr:`ClientRequestException.MATCH_PRIORITY`.
40
+ """
41
+
42
+ MATCH_PRIORITY = 0
43
+
44
+ _HRESULTS: tuple[str, ...] = ()
45
+ _TYPE_NAMES: tuple[str, ...] = ()
46
+
47
+ @classmethod
48
+ def matches(cls, payload: ErrorPayload) -> bool:
49
+ if not cls._HRESULTS and not cls._TYPE_NAMES:
50
+ # Catch-all: any SharePoint-flavoured code, whatever the concrete type.
51
+ return "microsoft.sharepoint." in payload.code.lower()
52
+ error_type = (payload.error_type or "").lower()
53
+ if payload.hresult is not None and payload.hresult in cls._HRESULTS:
54
+ return True
55
+ return any(name.lower() in error_type for name in cls._TYPE_NAMES)
56
+
57
+
58
+ class SecurityValidationException(SharePointException):
59
+ """Raised when SharePoint rejects an expired/invalid form digest (HTTP 403)."""
60
+
61
+ MATCH_PRIORITY = 10
62
+ _HRESULTS = ("-2130575251",)
63
+
64
+
65
+ class SPQueryThrottledException(SharePointException):
66
+ """Raised when a query exceeds the SharePoint **list view threshold**.
67
+
68
+ SharePoint blocks (HTTP 500) queries that filter or sort on a **non-indexed**
69
+ column and would scan/return more than the threshold (5,000 items by default),
70
+ and sometimes single-shot collection loads of a large collection. See
71
+ https://learn.microsoft.com/en-us/microsoft-365/community/how-to-handle-list-view-threshold
72
+
73
+ Classification keys off the stable error code (``-2147024860``) and the
74
+ embedded type name, so localized messages are handled the same way.
75
+ """
76
+
77
+ MATCH_PRIORITY = 10
78
+ _HRESULTS = ("-2147024860",)
79
+ _TYPE_NAMES = ("SPQueryThrottledException",)
80
+
81
+ GUIDANCE = (
82
+ f"This exceeds the SharePoint list view threshold ({LIST_VIEW_THRESHOLD:,} items by default). "
83
+ f"To fix it, either: (1) page through the data with get_all(page_size<={SAFE_PAGE_SIZE}) "
84
+ "(for list items) or Folder.get_files() / List.get_items(query, page_size=...); "
85
+ "(2) filter/sort on an indexed column - add one with List.ensure_indexed('Column'); "
86
+ "or (3) filter on ID (always indexed)."
87
+ )
88
+
89
+ def __str__(self) -> str:
90
+ return f"{super().__str__()}\n{self.GUIDANCE}"
91
+
92
+
93
+ class SPFileCheckOutException(SharePointException):
94
+ """Raised when a file operation is rejected because of its check-out state.
95
+
96
+ SharePoint returns HTTP 423 here too, but this is a *check-out* lock (an
97
+ explicit reservation), not the shared coauthoring lock behind
98
+ :class:`~office365.runtime.exceptions.FileLockedException`. A check-out can
99
+ be released by its owner, so it is actionable rather than permanent.
100
+ """
101
+
102
+ MATCH_PRIORITY = 15 # beats the status-only HTTP 423 match on FileLockedException
103
+ _HRESULTS = ("-2130575306",)
104
+ _TYPE_NAMES = ("SPFileCheckOutException",)
105
+
106
+ GUIDANCE = (
107
+ "The file is checked out (reserved for editing) by another session. Unlike a shared "
108
+ "coauthoring lock, a check-out can be released: the owner can call File.checkin(...) to "
109
+ "keep the changes or File.undocheckout() to discard them (permissions permitting)."
110
+ )
111
+
112
+ def __str__(self) -> str:
113
+ return f"{super().__str__()}\n{self.GUIDANCE}"
114
+
115
+
116
+ class SPListDataValidationException(SharePointException):
117
+ """Raised when a list-level or field-level validation formula rejects a value.
118
+
119
+ SharePoint reports both list validation and (field) value validation with
120
+ this type: ``-2130575162`` for the list formula, ``-2130575163`` for the field.
121
+ """
122
+
123
+ MATCH_PRIORITY = 15
124
+ _HRESULTS = ("-2130575162", "-2130575163")
125
+ _TYPE_NAMES = ("SPListDataValidationException",)
126
+
127
+
128
+ class SPFieldValidationException(SharePointException):
129
+ """Raised when a field value (or schema) is rejected — e.g. an unknown term."""
130
+
131
+ MATCH_PRIORITY = 15
132
+ _HRESULTS = ("-2146232832",)
133
+ _TYPE_NAMES = ("SPFieldValidationException",)
134
+
135
+
136
+ class SPFieldValueException(SharePointException):
137
+ """Raised when a field value is malformed or otherwise invalid."""
138
+
139
+ MATCH_PRIORITY = 15
140
+ _TYPE_NAMES = ("SPFieldValueException",)
141
+
142
+
143
+ class SPDuplicateValuesFoundException(SharePointException):
144
+ """Raised when a value already exists in a column that enforces unique values."""
145
+
146
+ MATCH_PRIORITY = 15
147
+ _HRESULTS = ("-2130575169",)
148
+ _TYPE_NAMES = ("SPDuplicateValuesFoundException",)
149
+
150
+
151
+ class SPInvalidLookupValuesException(SharePointException):
152
+ """Raised when a lookup value does not reference an existing item."""
153
+
154
+ MATCH_PRIORITY = 15
155
+ _TYPE_NAMES = ("SPInvalidLookupValuesException",)
156
+
157
+
158
+ class SPContentTypeReadOnlyException(SharePointException):
159
+ """Raised when mutating a read-only content type."""
160
+
161
+ MATCH_PRIORITY = 15
162
+ _TYPE_NAMES = ("SPContentTypeReadOnlyException",)
163
+
164
+
165
+ class SPContentTypeSealedException(SharePointException):
166
+ """Raised when mutating a sealed content type."""
167
+
168
+ MATCH_PRIORITY = 15
169
+ _TYPE_NAMES = ("SPContentTypeSealedException",)
170
+
171
+
172
+ _SP_EXCEPTION_TYPES = (
173
+ SecurityValidationException,
174
+ SPQueryThrottledException,
175
+ SPFileCheckOutException,
176
+ SPListDataValidationException,
177
+ SPFieldValidationException,
178
+ SPFieldValueException,
179
+ SPDuplicateValuesFoundException,
180
+ SPInvalidLookupValuesException,
181
+ SPContentTypeReadOnlyException,
182
+ SPContentTypeSealedException,
183
+ )
184
+
185
+
186
+ # Register the catch-all first so concrete types share its precedence baseline,
187
+ # then the concrete types (all higher priority).
188
+ def _register_exceptions() -> None:
189
+ register_error_type(SharePointException)
190
+ for exc_type in _SP_EXCEPTION_TYPES:
191
+ register_error_type(exc_type)
192
+
193
+
194
+ _register_exceptions()
@@ -1,38 +1,49 @@
1
- class SPBuiltInFieldId:
2
- """Retrieves identifiers for the fields that ship with Microsoft SharePoint Foundation."""
3
-
4
- Author = "Author"
5
- """Identifies a field that contains the specified author of the SharePoint Foundation object."""
6
-
7
- Created = "Created"
8
- """Identifies a field that contains the date and time when the specified SharePoint Foundation object was created"""
9
-
10
- FSObjType = "FSObjType"
11
- """Identifies a field that contains information about the file system type"""
1
+ """GUIDs of the built-in SharePoint fields (MS-WSSTS "Data Fields").
12
2
 
13
- FileDirRef = "FileDirRef"
14
- """Identifies a field that contains information about the file directory for the specified
15
- SharePoint Foundation object."""
3
+ Complements :class:`~office365.sharepoint.fields.builtin_field_name.SPBuiltInFieldName`
4
+ (names) with the stable field IDs from the MS-WSSTS specification
5
+ (https://learn.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-wssts/83747ceb-f9a5-456b-bc45-692671c6ce6b).
6
+ """
16
7
 
17
- FileLeafRef = "FileLeafRef"
18
- """Identifies a field that contains information about the server-relative URL for the file node that is
19
- associated with the specified SharePoint Foundation object."""
8
+ from __future__ import annotations
20
9
 
21
- FileType = "FileType"
22
- """Identifies a field that contains information about the file type for version history of the specified
23
- SharePoint Foundation library picture object."""
24
10
 
25
- FirstName = "FirstName"
26
- """Identifies a field that contains the first name for the specified SharePoint Foundation contact object."""
27
-
28
- FormData = "FormData"
29
- """Identifies a field that contains the FormData property for the specified
30
- Microsoft SharePoint Foundation contact object."""
31
-
32
- FormURN = "FormURN"
33
- """Identifies a field that contains the FormURN property for the specified
34
- Microsoft SharePoint Foundation contact object."""
35
-
36
- fRecurrence = "fRecurrence"
37
- """Identifies a field that contains information about the recurrence field of the specified SharePoint Foundation
38
- calendar event object."""
11
+ class SPBuiltInFieldId:
12
+ """GUIDs of the fields that ship with Microsoft SharePoint Foundation."""
13
+
14
+ _CopySource = "{6b4e226d-3d88-4a36-808d-a129bf52bccf}"
15
+ _HasCopyDestinations = "{26d0756c-986a-48a7-af35-bf18ab85ff4a}"
16
+ _IsCurrentVersion = "{c101c3e7-122d-4d4d-bc34-58e94a38c816}"
17
+ _Level = "{43bdd51b-3c5b-4e78-90a8-fb2087f71e70}"
18
+ _ModerationStatus = "{fdc3b2ed-5bf2-4835-a4bc-b885f3396a61}"
19
+ _UIVersion = "{7841bf41-43d0-4434-9f50-a673baef7631}"
20
+ _UIVersionString = "{dce8262a-3ae9-45aa-aab4-83bd75fb738a}"
21
+ Author = "{1df5e554-ec7e-46a6-901d-d85a3881cb18}"
22
+ BaseName = "{7615464b-559e-4302-b8e2-8f440b913101}"
23
+ ContentType = "{c042a256-787d-4a6f-8a8a-cf6ab767f12d}"
24
+ ContentTypeId = "{03e45e84-1992-4d42-9116-26f756012634}"
25
+ Created = "{8c06beca-0777-48f7-91c7-6da68bc07b69}"
26
+ Created_x0020_Date = "{998b5cff-4a35-47a7-92f3-3914aa6aa4a2}"
27
+ Editor = "{d31655d1-1d5b-4511-95a1-7a09e9b75bf2}"
28
+ EncodedAbsUrl = "{7177cfc7-f399-4d4d-905d-37dd51bc90bf}"
29
+ File_x0020_Type = "{39360f11-34cf-4356-9945-25c44e68dade}"
30
+ FileDirRef = "{56605df6-8fa1-47e4-a04c-5b384d59609f}"
31
+ FileLeafRef = "{8553196d-ec8d-4564-9861-3dbe931050c8}"
32
+ FileRef = "{94f89715-e097-4e8b-ba79-ea02aa8b7adb}"
33
+ FolderChildCount = "{960ff01f-2b6d-4f1b-9c3f-e19ad8927341}"
34
+ FSObjType = "{30bb605f-5bae-48fe-b4e3-1f81d9772af9}"
35
+ ID = "{1d22ea11-1e32-424e-89ab-9fedbadb6ce1}"
36
+ InstanceID = "{50a54da4-1528-4e67-954a-e2d24f1e9efb}"
37
+ ItemChildCount = "{b824e17e-a1b3-426e-aecf-f0184d900485}"
38
+ Last_x0020_Modified = "{173f76c8-aebd-446a-9bc9-769a2bd2c18f}"
39
+ MetaInfo = "{687c7f94-686a-42d3-9b67-2782eac4b4f8}"
40
+ Modified = "{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}"
41
+ Order = "{ca4addac-796f-4b23-b093-d2a3f65c0774}"
42
+ owshiddenversion = "{d4e44a66-ee3a-4d02-88c9-4ec5ff3f4cd5}"
43
+ PermMask = "{BA3C27EE-4791-4867-8821-FF99000BAC98}"
44
+ ProgId = "{c5c4b81c-f1d9-4b43-a6a2-090df32ebb68}"
45
+ ScopeId = "{dddd2420-b270-4735-93b5-92b713d0944d}"
46
+ ServerUrl = "{105f76ce-724a-4bba-aece-f81f2fce58f5}"
47
+ SortBehavior = "{423874f8-c300-4bfb-b7a1-42e2159e3b19}"
48
+ SyncClientId = "{6d2c4fde-3605-428e-a236-ce5f3dc2b4d4}"
49
+ UniqueId = "{4b7403de-8d94-43e8-9f0f-137a3e298126}"
@@ -0,0 +1,123 @@
1
+ """Built-in SharePoint field internal names — the single source of truth.
2
+
3
+ The names come from the MS-WSSTS "Data Fields" specification
4
+ (https://learn.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-wssts/83747ceb-f9a5-456b-bc45-692671c6ce6b).
5
+ Use :data:`SYSTEM_FIELD_NAMES` to filter system/bookkeeping columns out of a
6
+ projection or schema (migration, assessment, exporters).
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+
12
+ class SPBuiltInFieldName:
13
+ """Internal names of the built-in (system) SharePoint fields (MS-WSSTS)."""
14
+
15
+ _CopySource = "_CopySource"
16
+ _HasCopyDestinations = "_HasCopyDestinations"
17
+ _IsCurrentVersion = "_IsCurrentVersion"
18
+ _Level = "_Level"
19
+ _ModerationStatus = "_ModerationStatus"
20
+ _UIVersion = "_UIVersion"
21
+ _UIVersionString = "_UIVersionString"
22
+ Author = "Author"
23
+ BaseName = "BaseName"
24
+ ContentType = "ContentType"
25
+ ContentTypeId = "ContentTypeId"
26
+ Created = "Created"
27
+ Created_x0020_Date = "Created_x0020_Date"
28
+ Editor = "Editor"
29
+ EncodedAbsUrl = "EncodedAbsUrl"
30
+ File_x0020_Type = "File_x0020_Type"
31
+ FileDirRef = "FileDirRef"
32
+ FileLeafRef = "FileLeafRef"
33
+ FileRef = "FileRef"
34
+ FolderChildCount = "FolderChildCount"
35
+ FSObjType = "FSObjType"
36
+ ID = "ID"
37
+ InstanceID = "InstanceID"
38
+ ItemChildCount = "ItemChildCount"
39
+ Last_x0020_Modified = "Last_x0020_Modified"
40
+ MetaInfo = "MetaInfo"
41
+ Modified = "Modified"
42
+ Order = "Order"
43
+ owshiddenversion = "owshiddenversion"
44
+ PermMask = "PermMask"
45
+ ProgId = "ProgId"
46
+ ScopeId = "ScopeId"
47
+ ServerUrl = "ServerUrl"
48
+ SortBehavior = "SortBehavior"
49
+ SyncClientId = "SyncClientId"
50
+ UniqueId = "UniqueId"
51
+
52
+ ALL: frozenset[str] = frozenset(
53
+ {
54
+ _CopySource,
55
+ _HasCopyDestinations,
56
+ _IsCurrentVersion,
57
+ _Level,
58
+ _ModerationStatus,
59
+ _UIVersion,
60
+ _UIVersionString,
61
+ Author,
62
+ BaseName,
63
+ ContentType,
64
+ ContentTypeId,
65
+ Created,
66
+ Created_x0020_Date,
67
+ Editor,
68
+ EncodedAbsUrl,
69
+ File_x0020_Type,
70
+ FileDirRef,
71
+ FileLeafRef,
72
+ FileRef,
73
+ FolderChildCount,
74
+ FSObjType,
75
+ ID,
76
+ InstanceID,
77
+ ItemChildCount,
78
+ Last_x0020_Modified,
79
+ MetaInfo,
80
+ Modified,
81
+ Order,
82
+ owshiddenversion,
83
+ PermMask,
84
+ ProgId,
85
+ ScopeId,
86
+ ServerUrl,
87
+ SortBehavior,
88
+ SyncClientId,
89
+ UniqueId,
90
+ }
91
+ )
92
+
93
+ @classmethod
94
+ def is_builtin(cls, name: str) -> bool:
95
+ """Whether ``name`` is a built-in SharePoint field internal name."""
96
+ return name in cls.ALL
97
+
98
+
99
+ # System/bookkeeping columns that SharePoint exposes but the MS-WSSTS "Data
100
+ # Fields" list does not enumerate (moderation, versioning, app metadata, ...).
101
+ EXTRA_SYSTEM_FIELD_NAMES: frozenset[str] = frozenset(
102
+ {
103
+ "AppAuthor",
104
+ "AppEditor",
105
+ "Attachments",
106
+ "ComplianceAssetId",
107
+ "EffectivePermMask",
108
+ "GUID",
109
+ "Version",
110
+ "VirusStatus",
111
+ "WorkflowVersion",
112
+ "_CheckinComment",
113
+ "_ColorHex",
114
+ "_ColorTag",
115
+ "_CopySource",
116
+ "_Emoji",
117
+ "_HasCopyDestinations",
118
+ "_ModerationComments",
119
+ }
120
+ )
121
+
122
+ #: Every known system column internal name (spec + library extras).
123
+ SYSTEM_FIELD_NAMES: frozenset[str] = SPBuiltInFieldName.ALL | EXTRA_SYSTEM_FIELD_NAMES