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
@@ -20,6 +20,7 @@ from office365.runtime.odata.v3.batch_request import DEFAULT_MAX_BATCH_BYTES, OD
20
20
  from office365.runtime.odata.v3.json_light_format import JsonLightFormat
21
21
  from office365.runtime.paths.resource_path import ResourcePath
22
22
  from office365.runtime.types.collections import StringCollection
23
+ from office365.sharepoint.exceptions import SecurityValidationException
23
24
  from office365.sharepoint.portal.groups.creation_params import GroupCreationParams
24
25
  from office365.sharepoint.portal.groups.site_info import GroupSiteInfo
25
26
  from office365.sharepoint.portal.sites.creation_response import SPSiteCreationResponse
@@ -35,6 +36,7 @@ from office365.sharepoint.sites.site import Site
35
36
  from office365.sharepoint.tenant.administration.hubsites.collection import (
36
37
  HubSiteCollection,
37
38
  )
39
+ from office365.sharepoint.thresholds import Limits, limit
38
40
  from office365.sharepoint.ui.applicationpages.peoplepicker.web_service_interface import (
39
41
  ClientPeoplePickerWebServiceInterface,
40
42
  PeoplePickerWebServiceInterface,
@@ -209,20 +211,18 @@ class ClientContext(ClientRuntimeContext):
209
211
  return self
210
212
 
211
213
  def with_user_credentials(self, username: str, password: str) -> Self:
212
- """Initializes a client to acquire a token via user credentials.
214
+ """Initializes a client to acquire a token via user credentials (NTLM).
215
+
216
+ Only for **on-premises** SharePoint — construct the context with
217
+ ``ClientContext(url, allow_ntlm=True)``. For SharePoint Online this raises:
218
+ the legacy SAML/ACS flow is retired, use :meth:`with_username_and_password`.
213
219
 
214
220
  Args:
215
- username (str): Typically, a UPN in the form of an email address
216
- password (str): The password Note: This method uses the legacy SAML/ACS auth flow which Microsoft has
217
- retired for SharePoint Online. Use with_username_and_password instead.
218
- For on-premises SharePoint, use allow_ntlm=True.
221
+ username (str): A UPN, or ``DOMAIN\\user`` for NTLM
222
+ password (str): The password
219
223
  """
220
- raise RuntimeError(
221
- "with_user_credentials uses the legacy SAML/ACS auth flow which "
222
- "Microsoft has retired for SharePoint Online. "
223
- "Use with_username_and_password(tenant, client_id, username, password) instead. "
224
- "For on-premises SharePoint, use allow_ntlm=True."
225
- )
224
+ self.authentication_context.with_credentials(UserCredential(username, password))
225
+ return self
226
226
 
227
227
  def with_username_and_password(self, tenant: str, client_id: str, username: str, password: str) -> Self:
228
228
  """Initializes a client to acquire a token via Username and password authentication flow.
@@ -268,9 +268,10 @@ class ClientContext(ClientRuntimeContext):
268
268
  self.authentication_context.with_credentials(credentials)
269
269
  return self
270
270
 
271
+ @limit(Limits.BATCH_ITEMS, arg="items_per_batch")
271
272
  def execute_batch(
272
273
  self,
273
- items_per_batch: int = 100,
274
+ items_per_batch: int = Limits.BATCH_ITEMS.value,
274
275
  success_callback: Optional[Callable[[List[ClientObject | ClientResult]], None]] = None,
275
276
  concurrency: int = 1,
276
277
  max_batch_bytes: Optional[int] = None,
@@ -283,7 +284,7 @@ class ClientContext(ClientRuntimeContext):
283
284
  Throttled sub-requests (HTTP 429/503) are retried individually, honoring
284
285
  ``Retry-After`` — only the failed sub-requests are re-sent, so successful
285
286
  writes aren't re-applied. ``success_callback`` runs on the caller thread
286
- in completion order (not submission order).
287
+ as each batch completes (completion order when concurrent).
287
288
 
288
289
  Args:
289
290
  items_per_batch (int): Maximum to be selected for bulk operation
@@ -292,27 +293,41 @@ class ClientContext(ClientRuntimeContext):
292
293
  max_batch_bytes (int or None): Maximum estimated batch payload size (default ~1 MB)
293
294
  """
294
295
  max_bytes = DEFAULT_MAX_BATCH_BYTES if max_batch_bytes is None else max_batch_bytes
296
+ request = self.pending_request()
297
+ request.warm_up() # fetch the form digest once before dispatching any batch
295
298
  batches = self._split_batches(items_per_batch, max_bytes)
296
299
  if concurrency <= 1:
297
- batch_request = ODataBatchV3Request(self._base_url, JsonLightFormat())
298
- batch_request.beforeExecute += self.authentication_context.authenticate_request
299
- batch_request.beforeExecute += self.pending_request().ensure_form_digest
300
+ batch_request = ODataBatchV3Request(
301
+ self._base_url, JsonLightFormat(), transport=self.pending_request().transport
302
+ )
303
+ batch_request.beforeExecute += request._authenticate_request
304
+ batch_request.beforeExecute += request.ensure_form_digest
300
305
  for qry in batches:
301
- batch_request.execute_query_with_retry(qry)
302
- if callable(success_callback) and qry.return_type is not None:
303
- success_callback(qry.return_type)
306
+ self._run_batch(batch_request, qry)
307
+ if callable(success_callback):
308
+ success_callback(qry.return_types)
304
309
  return self
305
310
 
306
- self.pending_request()
307
311
  self._execute_batches_in_parallel(batches, concurrency, success_callback)
308
312
  return self
309
313
 
314
+ def _run_batch(self, batch_request: ODataBatchV3Request, batch_qry: "BatchQuery") -> None:
315
+ """Execute one batch, refreshing an expired form digest once and retrying."""
316
+ try:
317
+ batch_request.execute_query_with_retry(batch_qry)
318
+ except SecurityValidationException:
319
+ self.pending_request().invalidate_digest()
320
+ self.pending_request().warm_up()
321
+ batch_request.execute_query_with_retry(batch_qry)
322
+
310
323
  def _execute_batch(self, batch_qry: "BatchQuery") -> list[Any]:
311
324
  """Execute a single batch unit on a worker thread (with per-request retry)."""
312
- batch_request = ODataBatchV3Request(self._base_url, JsonLightFormat())
313
- batch_request.beforeExecute += self.authentication_context.authenticate_request
325
+ batch_request = ODataBatchV3Request(
326
+ self._base_url, JsonLightFormat(), transport=self.pending_request().transport
327
+ )
328
+ batch_request.beforeExecute += self.pending_request()._authenticate_request
314
329
  batch_request.beforeExecute += self.pending_request().ensure_form_digest
315
- batch_request.execute_query_with_retry(batch_qry)
330
+ self._run_batch(batch_request, batch_qry)
316
331
  return batch_qry.return_types
317
332
 
318
333
  def pending_request(self) -> SharePointRequest:
@@ -321,6 +336,8 @@ class ClientContext(ClientRuntimeContext):
321
336
  self._pending_request = SharePointRequest(
322
337
  base_url=self._base_url,
323
338
  environment=self._environment,
339
+ allow_ntlm=self._allow_ntlm,
340
+ browser_mode=self._browser_mode,
324
341
  authority=self._authority,
325
342
  )
326
343
  return self._pending_request # type: ignore[return-value]
@@ -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,21 @@ class HostedApp(Entity):
5
8
  @property
6
9
  def entity_type_name(self):
7
10
  return "Microsoft.SharePoint.ClientSideComponent.HostedApp"
11
+
12
+ def delete(self) -> Self:
13
+ """Delete operation."""
14
+ qry = ServiceOperationQuery(self, "Delete", None, {}, None, None)
15
+ self.context.add_query(qry)
16
+ return self
17
+
18
+ def update_web_part_data(self, web_part_data_as_json: str) -> Self:
19
+ """UpdateWebPartData operation.
20
+
21
+ Args:
22
+ web_part_data_as_json (str): webPartDataAsJson parameter
23
+ """
24
+ qry = ServiceOperationQuery(
25
+ self, "UpdateWebPartData", None, {"webPartDataAsJson": web_part_data_as_json}, None, None
26
+ )
27
+ self.context.add_query(qry)
28
+ return self
@@ -1,4 +1,6 @@
1
+ from office365.runtime.client_result import ClientResult
1
2
  from office365.runtime.paths.service_operation import ServiceOperationPath
3
+ from office365.runtime.queries.service_operation import ServiceOperationQuery
2
4
  from office365.sharepoint.clientsidecomponent.hostedapps.app import HostedApp
3
5
  from office365.sharepoint.entity import Entity
4
6
 
@@ -17,3 +19,17 @@ class HostedAppsManager(Entity):
17
19
  @property
18
20
  def entity_type_name(self):
19
21
  return "Microsoft.SharePoint.ClientSideComponent.HostedAppsManager"
22
+
23
+ def add(self, web_part_data_as_json: str, host_type: str) -> ClientResult[int]:
24
+ """Add operation.
25
+
26
+ Args:
27
+ web_part_data_as_json (str): webPartDataAsJson parameter
28
+ host_type (str): hostType parameter
29
+ """
30
+ return_type = ClientResult(self.context, int())
31
+ qry = ServiceOperationQuery(
32
+ self, "Add", None, {"webPartDataAsJson": web_part_data_as_json, "hostType": host_type}, None, return_type
33
+ )
34
+ self.context.add_query(qry)
35
+ return return_type
@@ -1,11 +1,19 @@
1
+ from datetime import datetime
2
+ from typing import Optional
3
+ from uuid import UUID
4
+
1
5
  from typing_extensions import Self
2
6
 
7
+ from office365.runtime.client_value_collection import ClientValueCollection
3
8
  from office365.runtime.paths.resource_path import ResourcePath
4
9
  from office365.runtime.queries.service_operation import ServiceOperationQuery
5
10
  from office365.runtime.types.odata_property import odata
11
+ from office365.sharepoint.comments.client.identity import Identity
12
+ from office365.sharepoint.comments.contentanchor import ContentAnchor
6
13
  from office365.sharepoint.entity import Entity
7
14
  from office365.sharepoint.entity_collection import EntityCollection
8
15
  from office365.sharepoint.likes.user_entity import UserEntity
16
+ from office365.sharepoint.sharing.principal import Principal
9
17
 
10
18
 
11
19
  class Comment(Entity):
@@ -33,10 +41,84 @@ class Comment(Entity):
33
41
  for the same user in the set.
34
42
  """
35
43
  return self.properties.get(
36
- "likedBy",
37
- EntityCollection(self.context, UserEntity, ResourcePath("likedBy", self.resource_path)),
44
+ "likedBy", EntityCollection(self.context, UserEntity, ResourcePath("likedBy", self.resource_path))
38
45
  )
39
46
 
40
47
  @property
41
48
  def entity_type_name(self) -> str:
42
49
  return "Microsoft.SharePoint.Comments.comment"
50
+
51
+ @property
52
+ def author(self) -> Principal:
53
+ """Gets the author property"""
54
+ return self.properties.get("author", Principal())
55
+
56
+ @property
57
+ def content_anchor(self) -> ContentAnchor:
58
+ """Gets the contentAnchor property"""
59
+ return self.properties.get("contentAnchor", ContentAnchor())
60
+
61
+ @property
62
+ def created_date(self) -> Optional[datetime]:
63
+ """Gets the createdDate property"""
64
+ return self.properties.get("createdDate", datetime.min)
65
+
66
+ @property
67
+ def id_(self) -> Optional[str]:
68
+ """Gets the id property"""
69
+ return self.properties.get("id", None)
70
+
71
+ @property
72
+ def is_liked_by_user(self) -> Optional[bool]:
73
+ """Gets the isLikedByUser property"""
74
+ return self.properties.get("isLikedByUser", None)
75
+
76
+ @property
77
+ def is_reply(self) -> Optional[bool]:
78
+ """Gets the isReply property"""
79
+ return self.properties.get("isReply", None)
80
+
81
+ @property
82
+ def item_id(self) -> Optional[int]:
83
+ """Gets the itemId property"""
84
+ return self.properties.get("itemId", None)
85
+
86
+ @property
87
+ def like_count(self) -> Optional[int]:
88
+ """Gets the likeCount property"""
89
+ return self.properties.get("likeCount", None)
90
+
91
+ @property
92
+ def list_id(self) -> Optional[UUID]:
93
+ """Gets the listId property"""
94
+ return self.properties.get("listId", None)
95
+
96
+ @property
97
+ def mentions(self) -> ClientValueCollection[Identity]:
98
+ """Gets the mentions property"""
99
+ return self.properties.get("mentions", ClientValueCollection[Identity](Identity))
100
+
101
+ @property
102
+ def modified_date(self) -> Optional[datetime]:
103
+ """Gets the modifiedDate property"""
104
+ return self.properties.get("modifiedDate", datetime.min)
105
+
106
+ @property
107
+ def parent_id(self) -> Optional[str]:
108
+ """Gets the parentId property"""
109
+ return self.properties.get("parentId", None)
110
+
111
+ @property
112
+ def relative_created_date(self) -> Optional[str]:
113
+ """Gets the relativeCreatedDate property"""
114
+ return self.properties.get("relativeCreatedDate", None)
115
+
116
+ @property
117
+ def reply_count(self) -> Optional[int]:
118
+ """Gets the replyCount property"""
119
+ return self.properties.get("replyCount", None)
120
+
121
+ @property
122
+ def text(self) -> Optional[str]:
123
+ """Gets the text property"""
124
+ return self.properties.get("text", None)
@@ -5,9 +5,7 @@ from uuid import UUID
5
5
  from typing_extensions import Self
6
6
 
7
7
  from office365.runtime.client_result import ClientResult
8
- from office365.runtime.queries.function import FunctionQuery
9
8
  from office365.runtime.queries.service_operation import ServiceOperationQuery
10
- from office365.runtime.types.collections import StringCollection
11
9
  from office365.sharepoint.contentcenter.machinelearning.modeldependencies import SPModelDependencies
12
10
  from office365.sharepoint.contentcenter.machinelearning.modelpublishconfig import SPModelPublishConfig
13
11
  from office365.sharepoint.entity import Entity
@@ -240,24 +238,3 @@ class SPMachineLearningModel(Entity):
240
238
  qry = ServiceOperationQuery(self, "UpdateModelTypeSpecificSettings", None, {"Settings": settings}, None)
241
239
  self.context.add_query(qry)
242
240
  return self
243
-
244
- def get_extractor_names(self, package_name: str) -> ClientResult[StringCollection]:
245
- """GetExtractorNames operation.
246
-
247
- Args:
248
- package_name (str): packageName parameter
249
- """
250
- return_type = ClientResult(self.context, StringCollection())
251
- qry = FunctionQuery(self, "GetExtractorNames", [package_name], return_type)
252
- self.context.add_query(qry)
253
- return return_type
254
-
255
- def unbind_model_from_content_type(self, content_type_id: str) -> Self:
256
- """UnbindModelFromContentType operation.
257
-
258
- Args:
259
- content_type_id (str): contentTypeId parameter
260
- """
261
- qry = ServiceOperationQuery(self, "UnbindModelFromContentType", None, {"contentTypeId": content_type_id}, None)
262
- self.context.add_query(qry)
263
- return self
@@ -4,8 +4,6 @@ from uuid import UUID
4
4
 
5
5
  from typing_extensions import Self
6
6
 
7
- from office365.runtime.client_result import ClientResult
8
- from office365.runtime.queries.function import FunctionQuery
9
7
  from office365.runtime.queries.service_operation import ServiceOperationQuery
10
8
  from office365.sharepoint.entity import Entity
11
9
 
@@ -175,10 +173,3 @@ class SPMachineLearningPublication(Entity):
175
173
  qry = ServiceOperationQuery(self, "Delete")
176
174
  self.context.add_query(qry)
177
175
  return self
178
-
179
- def check_tenant_publish_permissions(self) -> ClientResult[bool]:
180
- """CheckTenantPublishPermissions operation."""
181
- return_type = ClientResult(self.context, bool())
182
- qry = FunctionQuery(self, "CheckTenantPublishPermissions", [], return_type)
183
- self.context.add_query(qry)
184
- return return_type
@@ -2,10 +2,7 @@ from datetime import datetime
2
2
  from typing import Optional
3
3
  from uuid import UUID
4
4
 
5
- from office365.runtime.client_result import ClientResult
6
5
  from office365.runtime.client_value_collection import ClientValueCollection
7
- from office365.runtime.queries.function import FunctionQuery
8
- from office365.runtime.types.collections import StringCollection
9
6
  from office365.sharepoint.entity import Entity
10
7
 
11
8
 
@@ -128,14 +125,3 @@ class SPMachineLearningSample(Entity):
128
125
  def unique_id(self) -> Optional[UUID]:
129
126
  """Gets the UniqueId property"""
130
127
  return self.properties.get("UniqueId", None)
131
-
132
- def get_template_by_model_id(self, model_id: int) -> ClientResult[StringCollection]:
133
- """GetTemplateByModelId operation.
134
-
135
- Args:
136
- model_id (int): modelID parameter
137
- """
138
- return_type = ClientResult(self.context, StringCollection())
139
- qry = FunctionQuery(self, "GetTemplateByModelId", [model_id], return_type)
140
- self.context.add_query(qry)
141
- return return_type
@@ -2,23 +2,6 @@ from datetime import datetime
2
2
  from typing import Optional
3
3
  from uuid import UUID
4
4
 
5
- from office365.runtime.client_result import ClientResult
6
- from office365.runtime.queries.service_operation import ServiceOperationQuery
7
- from office365.sharepoint.contentcenter.machinelearning.column_autofill_preview_data import (
8
- SPMachineLearningColumnAutofillPreviewData,
9
- )
10
- from office365.sharepoint.contentcenter.machinelearning.column_autofill_preview_result import (
11
- SPMachineLearningColumnAutofillPreviewResult,
12
- )
13
- from office365.sharepoint.contentcenter.machinelearning.list_autofill_entity_data import (
14
- SPMachineLearningListAutofillEntityData,
15
- )
16
- from office365.sharepoint.contentcenter.machinelearning.list_autofill_item_results import (
17
- SPMachineLearningListAutofillItemResults,
18
- )
19
- from office365.sharepoint.contentcenter.machinelearning.sp_machine_learning_doc_lib_autofill_item_results import (
20
- SPMachineLearningDocLibAutofillItemResults,
21
- )
22
5
  from office365.sharepoint.entity import Entity
23
6
 
24
7
 
@@ -91,66 +74,3 @@ class SPMachineLearningWorkItem(Entity):
91
74
  def type_(self) -> Optional[UUID]:
92
75
  """Gets the Type property"""
93
76
  return self.properties.get("Type", None)
94
-
95
- def autofill_doc_lib_synchronous(
96
- self, parameters: SPMachineLearningListAutofillEntityData
97
- ) -> ClientResult[SPMachineLearningDocLibAutofillItemResults]:
98
- """AutofillDocLibSynchronous operation.
99
-
100
- Args:
101
- parameters (SPMachineLearningListAutofillEntityData): parameters parameter
102
- """
103
- return_type = ClientResult(self.context, SPMachineLearningDocLibAutofillItemResults())
104
- qry = ServiceOperationQuery(
105
- self, "AutofillDocLibSynchronous", None, {"parameters": parameters}, None, return_type
106
- )
107
- self.context.add_query(qry)
108
- return return_type
109
-
110
- def autofill_list_synchronous(
111
- self, parameters: SPMachineLearningListAutofillEntityData
112
- ) -> ClientResult[SPMachineLearningListAutofillItemResults]:
113
- """AutofillListSynchronous operation.
114
-
115
- Args:
116
- parameters (SPMachineLearningListAutofillEntityData): parameters parameter
117
- """
118
- return_type = ClientResult(self.context, SPMachineLearningListAutofillItemResults())
119
- qry = ServiceOperationQuery(self, "AutofillListSynchronous", None, {"parameters": parameters}, None, return_type)
120
- self.context.add_query(qry)
121
- return return_type
122
-
123
- def autofill_test_prompt(
124
- self, parameters: SPMachineLearningColumnAutofillPreviewData
125
- ) -> ClientResult[SPMachineLearningColumnAutofillPreviewResult]:
126
- """AutofillTestPrompt operation.
127
-
128
- Args:
129
- parameters (SPMachineLearningColumnAutofillPreviewData): parameters parameter
130
- """
131
- return_type = ClientResult(self.context, SPMachineLearningColumnAutofillPreviewResult())
132
- qry = ServiceOperationQuery(self, "AutofillTestPrompt", None, {"parameters": parameters}, None, return_type)
133
- self.context.add_query(qry)
134
- return return_type
135
-
136
- def create_doc_lib_autofill(self, parameters: SPMachineLearningListAutofillEntityData) -> ClientResult[str]:
137
- """CreateDocLibAutofill operation.
138
-
139
- Args:
140
- parameters (SPMachineLearningListAutofillEntityData): parameters parameter
141
- """
142
- return_type = ClientResult(self.context, str())
143
- qry = ServiceOperationQuery(self, "CreateDocLibAutofill", None, {"parameters": parameters}, None, return_type)
144
- self.context.add_query(qry)
145
- return return_type
146
-
147
- def create_list_autofill(self, parameters: SPMachineLearningListAutofillEntityData) -> ClientResult[str]:
148
- """CreateListAutofill operation.
149
-
150
- Args:
151
- parameters (SPMachineLearningListAutofillEntityData): parameters parameter
152
- """
153
- return_type = ClientResult(self.context, str())
154
- qry = ServiceOperationQuery(self, "CreateListAutofill", None, {"parameters": parameters}, None, return_type)
155
- self.context.add_query(qry)
156
- return return_type
@@ -0,0 +1,148 @@
1
+ from __future__ import annotations
2
+
3
+ from uuid import UUID
4
+
5
+ from typing_extensions import Self
6
+
7
+ from office365.runtime.client_result import ClientResult
8
+ from office365.runtime.client_value_collection import ClientValueCollection
9
+ from office365.runtime.queries.function import FunctionQuery
10
+ from office365.runtime.queries.service_operation import ServiceOperationQuery
11
+ from office365.sharepoint.contentsolution.add_template_fields_request import AddTemplateFieldsRequest
12
+ from office365.sharepoint.contentsolution.content_control_std_content import ContentControlStdContent
13
+ from office365.sharepoint.contentsolution.create_template_request import CreateTemplateRequest
14
+ from office365.sharepoint.contentsolution.document_field import DocumentField
15
+ from office365.sharepoint.contentsolution.field_input import FieldInput
16
+ from office365.sharepoint.contentsolution.template import Template
17
+ from office365.sharepoint.contentsolution.update_template_field_request import UpdateTemplateFieldRequest
18
+ from office365.sharepoint.entity import Entity
19
+
20
+
21
+ class TemplateAPI(Entity):
22
+ def add_fields(self, request: AddTemplateFieldsRequest) -> ClientResult[ClientValueCollection[DocumentField]]:
23
+ """addFields operation.
24
+
25
+ Args:
26
+ request (AddTemplateFieldsRequest): request parameter
27
+ """
28
+ return_type = ClientResult(self.context, ClientValueCollection[DocumentField]())
29
+ qry = ServiceOperationQuery(self, "addFields", None, {"request": request}, None, return_type)
30
+ self.context.add_query(qry)
31
+ return return_type
32
+
33
+ def create_document(self) -> Self:
34
+ """createDocument operation."""
35
+ qry = ServiceOperationQuery(self, "createDocument", None, {}, None, None)
36
+ self.context.add_query(qry)
37
+ return self
38
+
39
+ def create_template(self, request: CreateTemplateRequest) -> ClientResult[Template]:
40
+ """createTemplate operation.
41
+
42
+ Args:
43
+ request (CreateTemplateRequest): request parameter
44
+ """
45
+ return_type = ClientResult(self.context, Template())
46
+ qry = ServiceOperationQuery(self, "createTemplate", None, {"request": request}, None, return_type)
47
+ self.context.add_query(qry)
48
+ return return_type
49
+
50
+ def create_template_using_stream(
51
+ self,
52
+ document_folder_id: int,
53
+ document_library_id: UUID,
54
+ document_site_id: UUID,
55
+ document_web_id: UUID,
56
+ fields: ClientValueCollection[FieldInput],
57
+ form_id: str,
58
+ template_name: str,
59
+ content_stream: bytes,
60
+ ) -> ClientResult[Template]:
61
+ """CreateTemplateUsingStream operation.
62
+
63
+ Args:
64
+ document_folder_id (int): DocumentFolderId parameter
65
+ document_library_id (UUID): DocumentLibraryId parameter
66
+ document_site_id (UUID): DocumentSiteId parameter
67
+ document_web_id (UUID): DocumentWebId parameter
68
+ fields (ClientValueCollection[FieldInput]): Fields parameter
69
+ form_id (str): FormId parameter
70
+ template_name (str): TemplateName parameter
71
+ content_stream (bytes): contentStream parameter
72
+ """
73
+ return_type = ClientResult(self.context, Template())
74
+ qry = ServiceOperationQuery(
75
+ self,
76
+ "CreateTemplateUsingStream",
77
+ None,
78
+ {
79
+ "DocumentFolderId": document_folder_id,
80
+ "DocumentLibraryId": document_library_id,
81
+ "DocumentSiteId": document_site_id,
82
+ "DocumentWebId": document_web_id,
83
+ "Fields": fields,
84
+ "FormId": form_id,
85
+ "TemplateName": template_name,
86
+ "contentStream": content_stream,
87
+ },
88
+ None,
89
+ return_type,
90
+ )
91
+ self.context.add_query(qry)
92
+ return return_type
93
+
94
+ def get_content_control_standard_content(
95
+ self, template_id: UUID, fetch_conditionals_only: bool
96
+ ) -> ClientResult[ClientValueCollection[ContentControlStdContent]]:
97
+ """getContentControlStandardContent operation.
98
+
99
+ Args:
100
+ template_id (UUID): templateId parameter
101
+ fetch_conditionals_only (bool): fetchConditionalsOnly parameter
102
+ """
103
+ return_type = ClientResult(self.context, ClientValueCollection[ContentControlStdContent]())
104
+ qry = FunctionQuery(
105
+ self, "getContentControlStandardContent", [template_id, fetch_conditionals_only], return_type
106
+ )
107
+ self.context.add_query(qry)
108
+ return return_type
109
+
110
+ def get_fields(self, template_id: UUID, version_type: int) -> ClientResult[ClientValueCollection[DocumentField]]:
111
+ """getFields operation.
112
+
113
+ Args:
114
+ template_id (UUID): templateId parameter
115
+ version_type (int): versionType parameter
116
+ """
117
+ return_type = ClientResult(self.context, ClientValueCollection[DocumentField]())
118
+ qry = FunctionQuery(self, "getFields", [template_id, version_type], return_type)
119
+ self.context.add_query(qry)
120
+ return return_type
121
+
122
+ def get_template(self, template_id: UUID) -> ClientResult[Template]:
123
+ """getTemplate operation.
124
+
125
+ Args:
126
+ template_id (UUID): templateId parameter
127
+ """
128
+ return_type = ClientResult(self.context, Template())
129
+ qry = FunctionQuery(self, "getTemplate", [template_id], return_type)
130
+ self.context.add_query(qry)
131
+ return return_type
132
+
133
+ def publish_template(self) -> Self:
134
+ """publishTemplate operation."""
135
+ qry = ServiceOperationQuery(self, "publishTemplate", None, {}, None, None)
136
+ self.context.add_query(qry)
137
+ return self
138
+
139
+ def update_field(self, request: UpdateTemplateFieldRequest) -> ClientResult[DocumentField]:
140
+ """updateField operation.
141
+
142
+ Args:
143
+ request (UpdateTemplateFieldRequest): request parameter
144
+ """
145
+ return_type = ClientResult(self.context, DocumentField())
146
+ qry = ServiceOperationQuery(self, "updateField", None, {"request": request}, None, return_type)
147
+ self.context.add_query(qry)
148
+ return return_type
@@ -2,7 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  from typing import Dict, Optional, cast
4
4
 
5
- from office365.runtime.client_request_exception import ClientRequestException, DuplicatedObjectException
6
5
  from office365.runtime.paths.service_operation import ServiceOperationPath
7
6
  from office365.runtime.queries.create_entity import CreateEntityQuery
8
7
  from office365.runtime.queries.service_operation import ServiceOperationQuery
@@ -41,17 +40,40 @@ class ContentTypeCollection(EntityCollection[ContentType]):
41
40
  self,
42
41
  )
43
42
 
44
- def ensure(self, name: str, description: str | None = None, group: str | None = None) -> ContentType:
45
- """Ensure a content type with the given name exists (idempotent)."""
46
- info = ContentTypeCreationInformation(name, description, group)
47
- return_type = self.add(info)
43
+ def ensure(
44
+ self,
45
+ name: str,
46
+ description: str | None = None,
47
+ group: str | None = None,
48
+ *,
49
+ on_conflict: str = "skip",
50
+ ) -> ContentType:
51
+ """Ensure a content type with the given name exists (idempotent).
48
52
 
49
- def _on_error(error: ClientRequestException):
50
- if not isinstance(error, DuplicatedObjectException):
51
- raise error
52
- self.get_by_name(name).after_execute(lambda existing: return_type.copy_from(existing), execute_first=True)
53
+ With ``on_conflict="update"`` the existing content type's description and
54
+ group are reconciled.
55
+ """
56
+ from office365.runtime.queries.get_or_create import create_or_get
57
+
58
+ info = ContentTypeCreationInformation(name, description, group)
53
59
 
54
- return return_type.on_error(_on_error)
60
+ def _reconcile(content_type: ContentType) -> None:
61
+ changed = False
62
+ if description is not None and content_type.description != description:
63
+ content_type.set_property("Description", description)
64
+ changed = True
65
+ if group is not None and content_type.group != group:
66
+ content_type.set_property("Group", group)
67
+ changed = True
68
+ if changed:
69
+ content_type.update()
70
+
71
+ return create_or_get(
72
+ create=lambda: self.add(info),
73
+ find=lambda: self.get_by_name(name),
74
+ on_conflict=on_conflict,
75
+ reconcile=_reconcile,
76
+ )
55
77
 
56
78
  def add(self, content_type_info: ContentTypeCreationInformation) -> ContentType:
57
79
  """Adds a new content type to the collection and returns a reference to the added SP.ContentType.