Office365-REST-Python-Client 2.5.1__py3-none-any.whl → 2.5.3__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 (271) hide show
  1. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/METADATA +6 -6
  2. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/RECORD +265 -259
  3. office365/base_item.py +12 -20
  4. office365/communications/onlinemeetings/collection.py +1 -1
  5. office365/communications/onlinemeetings/online_meeting.py +20 -35
  6. office365/communications/presences/presence.py +18 -7
  7. office365/delta_collection.py +10 -1
  8. office365/delta_path.py +1 -1
  9. office365/directory/administrative_unit.py +6 -7
  10. office365/directory/applications/application.py +24 -18
  11. office365/directory/applications/roles/assignment.py +13 -1
  12. office365/directory/applications/roles/collection.py +13 -0
  13. office365/directory/applications/roles/role.py +6 -1
  14. office365/directory/audit/directory.py +8 -7
  15. office365/directory/audit/log_root.py +3 -0
  16. office365/directory/audit/signins/signin.py +19 -29
  17. office365/directory/authentication/authentication.py +1 -0
  18. office365/directory/authentication/methods/details.py +8 -6
  19. office365/directory/authentication/methods/phone.py +3 -1
  20. office365/directory/extensions/extension_property.py +7 -9
  21. office365/directory/groups/collection.py +10 -3
  22. office365/directory/groups/group.py +19 -19
  23. office365/directory/groups/lifecycle_policy.py +8 -7
  24. office365/directory/identities/provider.py +5 -6
  25. office365/directory/insights/usage_details.py +8 -3
  26. office365/directory/internal/paths/me.py +1 -1
  27. office365/directory/invitations/collection.py +1 -1
  28. office365/directory/invitations/invitation.py +6 -6
  29. office365/directory/object_collection.py +2 -3
  30. office365/directory/permissions/email_identity.py +7 -0
  31. office365/directory/permissions/grants/resource_specific.py +10 -9
  32. office365/directory/permissions/identity.py +3 -0
  33. office365/directory/permissions/identity_set.py +3 -0
  34. office365/directory/policies/base.py +4 -4
  35. office365/directory/policies/root.py +6 -4
  36. office365/directory/protection/information.py +3 -3
  37. office365/directory/rolemanagement/application.py +2 -0
  38. office365/directory/rolemanagement/role.py +11 -10
  39. office365/directory/rolemanagement/template.py +9 -8
  40. office365/directory/rolemanagement/unified_role_assignment.py +5 -4
  41. office365/directory/rolemanagement/unified_role_definition.py +6 -4
  42. office365/directory/security/security.py +3 -0
  43. office365/directory/serviceprincipals/collection.py +20 -4
  44. office365/directory/serviceprincipals/service_principal.py +79 -12
  45. office365/directory/users/activities/activity.py +5 -4
  46. office365/directory/users/user.py +29 -34
  47. office365/entity.py +2 -2
  48. office365/entity_collection.py +12 -5
  49. office365/graph_client.py +90 -8
  50. office365/intune/audit/event.py +4 -3
  51. office365/intune/devices/enrollment/configuration.py +6 -4
  52. office365/intune/devices/managed.py +9 -12
  53. office365/onedrive/analytics/item_activity_stat.py +4 -3
  54. office365/onedrive/columns/column_link.py +4 -4
  55. office365/onedrive/columns/definition.py +29 -32
  56. office365/onedrive/columns/definition_collection.py +1 -1
  57. office365/onedrive/contenttypes/content_type.py +16 -18
  58. office365/onedrive/documentsets/version.py +7 -3
  59. office365/onedrive/driveitems/driveItem.py +48 -49
  60. office365/onedrive/drives/drive.py +7 -2
  61. office365/onedrive/internal/paths/children.py +2 -2
  62. office365/onedrive/internal/paths/root.py +1 -1
  63. office365/onedrive/internal/paths/shared.py +1 -1
  64. office365/onedrive/internal/paths/site.py +3 -3
  65. office365/onedrive/internal/paths/url.py +2 -2
  66. office365/onedrive/listitems/list_item.py +2 -0
  67. office365/onedrive/lists/list.py +7 -4
  68. office365/onedrive/permissions/collection.py +28 -7
  69. office365/onedrive/permissions/permission.py +5 -7
  70. office365/onedrive/permissions/sharing_link.py +1 -1
  71. office365/onedrive/sharepoint.py +1 -0
  72. office365/onedrive/shares/collection.py +2 -5
  73. office365/onedrive/shares/drive_item.py +4 -0
  74. office365/onedrive/sites/site.py +6 -0
  75. office365/onedrive/termstore/groups/collection.py +3 -8
  76. office365/onedrive/termstore/groups/group.py +8 -0
  77. office365/onedrive/termstore/sets/collection.py +2 -6
  78. office365/onedrive/termstore/sets/name.py +5 -0
  79. office365/onedrive/termstore/sets/set.py +7 -0
  80. office365/onedrive/termstore/store.py +10 -13
  81. office365/onedrive/versions/drive_item.py +3 -1
  82. office365/onedrive/workbooks/ranges/range.py +9 -13
  83. office365/onedrive/workbooks/ranges/view.py +1 -0
  84. office365/onedrive/workbooks/tables/rows/row.py +3 -0
  85. office365/onedrive/workbooks/tables/table.py +7 -4
  86. office365/onedrive/workbooks/worksheets/worksheet.py +12 -4
  87. office365/onenote/entity_hierarchy_model.py +4 -0
  88. office365/onenote/internal/multipart_page_query.py +4 -5
  89. office365/onenote/notebooks/notebook.py +4 -0
  90. office365/onenote/pages/collection.py +3 -2
  91. office365/onenote/resources/resource.py +5 -4
  92. office365/onenote/sectiongroups/section_group.py +10 -7
  93. office365/onenote/sections/section.py +1 -1
  94. office365/outlook/calendar/attendees/base.py +2 -1
  95. office365/outlook/calendar/calendar.py +18 -10
  96. office365/outlook/calendar/events/collection.py +0 -2
  97. office365/outlook/calendar/group.py +7 -8
  98. office365/outlook/calendar/meetingtimes/suggestion.py +8 -4
  99. office365/outlook/calendar/meetingtimes/time_slot.py +3 -0
  100. office365/outlook/calendar/permissions/collection.py +1 -1
  101. office365/outlook/calendar/rooms/__init__.py +0 -0
  102. office365/outlook/calendar/rooms/list.py +27 -0
  103. office365/outlook/calendar/rooms/room.py +8 -0
  104. office365/outlook/calendar/schedule/information.py +0 -1
  105. office365/outlook/contacts/collection.py +0 -8
  106. office365/outlook/contacts/contact.py +14 -14
  107. office365/outlook/contacts/folder.py +3 -0
  108. office365/outlook/mail/attachments/attachment.py +31 -31
  109. office365/outlook/mail/attachments/collection.py +34 -6
  110. office365/outlook/mail/conversation.py +6 -4
  111. office365/outlook/mail/folders/collection.py +0 -7
  112. office365/outlook/mail/folders/folder.py +50 -18
  113. office365/outlook/mail/messages/collection.py +0 -1
  114. office365/outlook/mail/messages/message.py +58 -68
  115. office365/outlook/mail/physical_address.py +11 -5
  116. office365/outlook/mail/recipient.py +3 -1
  117. office365/outlook/mail/recurrence_range.py +14 -6
  118. office365/outlook/user.py +1 -0
  119. office365/planner/planner.py +9 -12
  120. office365/planner/plans/collection.py +17 -18
  121. office365/planner/plans/container.py +11 -0
  122. office365/planner/plans/plan.py +21 -10
  123. office365/runtime/auth/authentication_context.py +3 -3
  124. office365/runtime/auth/providers/acs_token_provider.py +7 -9
  125. office365/runtime/auth/providers/saml_token_provider.py +5 -2
  126. office365/runtime/client_object.py +6 -15
  127. office365/runtime/client_object_collection.py +36 -35
  128. office365/runtime/client_result.py +6 -7
  129. office365/runtime/client_runtime_context.py +10 -16
  130. office365/runtime/client_value_collection.py +3 -10
  131. office365/runtime/compat.py +2 -0
  132. office365/runtime/odata/query_options.py +1 -3
  133. office365/runtime/odata/reader.py +1 -1
  134. office365/runtime/odata/request.py +2 -4
  135. office365/runtime/odata/type.py +17 -0
  136. office365/runtime/odata/v4/upload_session_request.py +27 -30
  137. office365/runtime/paths/appid.py +1 -1
  138. office365/runtime/{odata/url_builder.py → paths/builder.py} +24 -9
  139. office365/runtime/paths/item.py +3 -1
  140. office365/runtime/paths/resource_path.py +12 -16
  141. office365/runtime/paths/service_operation.py +8 -7
  142. office365/runtime/paths/v3/__init__.py +0 -0
  143. office365/runtime/paths/{key.py → v3/entity.py} +5 -5
  144. office365/runtime/paths/v4/__init__.py +0 -0
  145. office365/runtime/paths/{entity.py → v4/entity.py} +13 -11
  146. office365/runtime/queries/function.py +1 -1
  147. office365/runtime/types/event_handler.py +1 -3
  148. office365/search/entity.py +15 -8
  149. office365/search/external/external.py +1 -0
  150. office365/search/sort_property.py +3 -0
  151. office365/sharepoint/attachments/attachment.py +3 -1
  152. office365/sharepoint/attachments/collection.py +3 -0
  153. office365/sharepoint/changes/change.py +12 -1
  154. office365/sharepoint/changes/collection.py +1 -1
  155. office365/sharepoint/changes/list.py +3 -0
  156. office365/sharepoint/changes/token.py +4 -0
  157. office365/sharepoint/changes/type.py +23 -23
  158. office365/sharepoint/changes/web.py +7 -3
  159. office365/sharepoint/client_context.py +21 -18
  160. office365/sharepoint/clientsidecomponent/hostedapps/manager.py +3 -3
  161. office365/sharepoint/contenttypes/content_type.py +47 -56
  162. office365/sharepoint/contenttypes/content_type_id.py +1 -1
  163. office365/sharepoint/documentmanagement/document_id.py +2 -2
  164. office365/sharepoint/documentmanagement/document_set.py +6 -7
  165. office365/sharepoint/entity_collection.py +9 -0
  166. office365/sharepoint/features/feature.py +6 -8
  167. office365/sharepoint/fields/collection.py +6 -5
  168. office365/sharepoint/fields/field.py +28 -46
  169. office365/sharepoint/fields/related_field_collection.py +1 -1
  170. office365/sharepoint/fields/user_value.py +3 -3
  171. office365/sharepoint/files/checked_out_file.py +4 -2
  172. office365/sharepoint/files/checked_out_file_collection.py +1 -1
  173. office365/sharepoint/files/collection.py +84 -14
  174. office365/sharepoint/files/file.py +118 -110
  175. office365/sharepoint/files/versions/collection.py +5 -3
  176. office365/sharepoint/files/versions/event.py +6 -3
  177. office365/sharepoint/files/versions/version.py +31 -18
  178. office365/sharepoint/folders/collection.py +5 -10
  179. office365/sharepoint/folders/folder.py +41 -24
  180. office365/sharepoint/forms/collection.py +1 -1
  181. office365/sharepoint/forms/form.py +4 -4
  182. office365/sharepoint/internal/paths/static_operation.py +9 -0
  183. office365/sharepoint/internal/paths/web.py +20 -0
  184. office365/sharepoint/listitems/collection.py +4 -0
  185. office365/sharepoint/listitems/listitem.py +37 -38
  186. office365/sharepoint/listitems/versions/collection.py +1 -1
  187. office365/sharepoint/listitems/versions/version.py +18 -11
  188. office365/sharepoint/lists/collection.py +1 -2
  189. office365/sharepoint/lists/list.py +106 -153
  190. office365/sharepoint/marketplace/app_metadata_collection.py +3 -1
  191. office365/sharepoint/navigation/node.py +16 -15
  192. office365/sharepoint/navigation/node_collection.py +9 -3
  193. office365/sharepoint/permissions/base_permissions.py +11 -6
  194. office365/sharepoint/permissions/roles/assignments/collection.py +8 -12
  195. office365/sharepoint/permissions/roles/definitions/definition.py +3 -1
  196. office365/sharepoint/permissions/securable_object.py +38 -31
  197. office365/sharepoint/portal/groups/service.py +12 -16
  198. office365/sharepoint/portal/groups/site_manager.py +0 -1
  199. office365/sharepoint/principal/groups/group.py +24 -30
  200. office365/sharepoint/principal/principal.py +21 -19
  201. office365/sharepoint/principal/users/collection.py +5 -0
  202. office365/sharepoint/principal/users/user.py +20 -26
  203. office365/sharepoint/publishing/pages/collection.py +1 -4
  204. office365/sharepoint/publishing/pages/metadata.py +38 -51
  205. office365/sharepoint/publishing/pages/metadata_collection.py +5 -2
  206. office365/sharepoint/publishing/pages/page.py +12 -21
  207. office365/sharepoint/publishing/pages/reposts/repost.py +5 -9
  208. office365/sharepoint/publishing/pages/service.py +36 -49
  209. office365/sharepoint/pushnotifications/collection.py +3 -1
  210. office365/sharepoint/recyclebin/item.py +11 -9
  211. office365/sharepoint/recyclebin/item_collection.py +1 -1
  212. office365/sharepoint/search/service.py +8 -6
  213. office365/sharepoint/sharing/links/info.py +5 -2
  214. office365/sharepoint/sharing/links/share_response.py +3 -0
  215. office365/sharepoint/sharing/links/share_settings.py +3 -0
  216. office365/sharepoint/sharing/object_sharing_information.py +25 -19
  217. office365/sharepoint/sharing/object_sharing_information_user.py +10 -19
  218. office365/sharepoint/sharing/result.py +18 -41
  219. office365/sharepoint/sharing/role.py +20 -0
  220. office365/sharepoint/sharing/role_type.py +1 -0
  221. office365/sharepoint/sharing/user_sharing_result.py +12 -0
  222. office365/sharepoint/sites/language.py +6 -0
  223. office365/sharepoint/sites/language_collection.py +3 -0
  224. office365/sharepoint/sites/site.py +65 -86
  225. office365/sharepoint/storagemetrics/storage_metrics.py +5 -6
  226. office365/sharepoint/taxonomy/item.py +11 -10
  227. office365/sharepoint/taxonomy/stores/store.py +8 -8
  228. office365/sharepoint/taxonomy/terms/label.py +3 -0
  229. office365/sharepoint/taxonomy/terms/term.py +31 -0
  230. office365/sharepoint/tenant/administration/collaboration/insights_overview.py +10 -0
  231. office365/sharepoint/tenant/administration/hubsites/collection.py +1 -2
  232. office365/sharepoint/tenant/administration/hubsites/hub_site.py +20 -24
  233. office365/sharepoint/tenant/administration/internal/permission_grant.py +7 -0
  234. office365/sharepoint/tenant/administration/sites/properties.py +55 -44
  235. office365/sharepoint/tenant/administration/tenant.py +69 -69
  236. office365/sharepoint/types/resource_path.py +2 -2
  237. office365/sharepoint/ui/applicationpages/peoplepicker/query_parameters.py +1 -1
  238. office365/sharepoint/usercustomactions/collection.py +1 -2
  239. office365/sharepoint/userprofiles/my_site_links.py +4 -4
  240. office365/sharepoint/userprofiles/people_manager.py +1 -3
  241. office365/sharepoint/userprofiles/user_profile.py +9 -11
  242. office365/sharepoint/utilities/principal_info.py +12 -0
  243. office365/sharepoint/viva/employee_engagement.py +1 -1
  244. office365/sharepoint/webparts/definition_collection.py +1 -1
  245. office365/sharepoint/webs/collection.py +8 -0
  246. office365/sharepoint/webs/template_collection.py +3 -5
  247. office365/sharepoint/webs/web.py +75 -95
  248. office365/subscriptions/collection.py +1 -1
  249. office365/subscriptions/subscription.py +13 -11
  250. office365/teams/apps/app.py +1 -0
  251. office365/teams/channels/channel.py +1 -3
  252. office365/teams/collection.py +12 -16
  253. office365/teams/info.py +7 -4
  254. office365/teams/members/conversation_collection.py +1 -3
  255. office365/teams/operations/async_operation.py +3 -5
  256. office365/teams/schedule/groups/group.py +3 -0
  257. office365/teams/team.py +18 -20
  258. office365/todo/attachments/base.py +7 -9
  259. office365/todo/linked_resource.py +6 -6
  260. office365/todo/tasks/list.py +1 -0
  261. office365/todo/tasks/task.py +3 -0
  262. office365/onedrive/internal/queries/resumable_file_upload.py +0 -36
  263. office365/outlook/internal/queries/attachment_upload.py +0 -53
  264. office365/runtime/odata/path_builder.py +0 -23
  265. office365/sharepoint/internal/key_value.py +0 -28
  266. office365/sharepoint/internal/queries/create_file.py +0 -20
  267. office365/sharepoint/internal/queries/upload_session.py +0 -103
  268. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/LICENSE +0 -0
  269. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/WHEEL +0 -0
  270. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/top_level.txt +0 -0
  271. /office365/planner/plans/{plan_details.py → details.py} +0 -0
@@ -1,53 +1,49 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.entity import Entity
2
4
 
3
5
 
4
6
  class HubSite(Entity):
5
7
  """SharePoint hub sites help you meet the needs of your organization by connecting and organizing sites"""
6
8
 
9
+ def __str__(self):
10
+ return self.title or self.entity_type_name
11
+
12
+ def __repr__(self):
13
+ return self.site_url or self.entity_type_name
14
+
7
15
  @property
8
16
  def id(self):
9
- """Gets the id of the hub site.
10
-
11
- :rtype: str or None
12
- """
17
+ # type: () -> Optional[str]
18
+ """Gets the id of the hub site."""
13
19
  return self.properties.get("ID", None)
14
20
 
15
21
  @property
16
22
  def description(self):
17
- """Gets the description of the hub site type.
18
-
19
- :rtype: str or None
20
- """
23
+ # type: () -> Optional[str]
24
+ """Gets the description of the hub site type."""
21
25
  return self.properties.get("Description", None)
22
26
 
23
27
  @property
24
28
  def site_url(self):
25
- """Gets the url of the hub site.
26
-
27
- :rtype: str or None
28
- """
29
+ # type: () -> Optional[str]
30
+ """Gets the url of the hub site."""
29
31
  return self.properties.get("SiteUrl", None)
30
32
 
31
33
  @property
32
34
  def targets(self):
33
- """List of security groups with access to join the hub site. Null if everyone has permission.
34
-
35
- :rtype: str or None
36
- """
35
+ # type: () -> Optional[str]
36
+ """List of security groups with access to join the hub site. Null if everyone has permission."""
37
37
  return self.properties.get("Targets", None)
38
38
 
39
39
  @property
40
40
  def title(self):
41
- """Gets the title of the hub site.
42
-
43
- :rtype: str or None
44
- """
41
+ # type: () -> Optional[str]
42
+ """Gets the title of the hub site."""
45
43
  return self.properties.get("Title", None)
46
44
 
47
45
  @property
48
46
  def tenant_instance_id(self):
49
- """Gets The tenant instance ID in which the hub site is located.
50
-
51
- :rtype: str or None
52
- """
47
+ # type: () -> Optional[str]
48
+ """Gets The tenant instance ID in which the hub site is located."""
53
49
  return self.properties.get("TenantInstanceId", None)
@@ -0,0 +1,7 @@
1
+ from office365.sharepoint.entity import Entity
2
+
3
+
4
+ class SPO3rdPartyAADPermissionGrant(Entity):
5
+ @property
6
+ def entity_type_name(self):
7
+ return "Microsoft.Online.SharePoint.TenantAdministration.Internal.SPO3rdPartyAADPermissionGrant"
@@ -1,24 +1,27 @@
1
1
  from typing import Optional
2
2
 
3
- from office365.runtime.paths.key import KeyPath
3
+ from office365.onedrive.listitems.list_item import ListItem
4
4
  from office365.runtime.paths.service_operation import ServiceOperationPath
5
+ from office365.runtime.paths.v3.entity import EntityPath
5
6
  from office365.runtime.queries.service_operation import ServiceOperationQuery
7
+ from office365.sharepoint.client_context import ClientContext
6
8
  from office365.sharepoint.entity import Entity
7
- from office365.sharepoint.sites.site import Site
9
+ from office365.sharepoint.internal.paths.static_operation import StaticOperationPath
8
10
  from office365.sharepoint.tenant.administration.deny_add_and_customize_pages_status import (
9
11
  DenyAddAndCustomizePagesStatus,
10
12
  )
13
+ from office365.sharepoint.tenant.administration.spo_operation import SpoOperation
11
14
 
12
15
 
13
16
  class SiteProperties(Entity):
14
17
  """Contains a property bag of information about a site."""
15
18
 
19
+ def __repr__(self):
20
+ return self.url or self.entity_type_name
21
+
16
22
  @staticmethod
17
23
  def clear_sharing_lock_down(context, site_url):
18
- """
19
- :param office365.sharepoint.client_context.ClientContext context: SharePoint client service
20
- :param str site_url:
21
- """
24
+ # type: (ClientContext, str) -> SiteProperties
22
25
  payload = {"siteUrl": site_url}
23
26
  binding_type = SiteProperties(context)
24
27
  qry = ServiceOperationQuery(
@@ -30,75 +33,71 @@ class SiteProperties(Entity):
30
33
  def update(self):
31
34
  """Updates the site collection properties with the new properties specified in the SiteProperties object."""
32
35
 
33
- site = Site(self.context)
34
- site.set_property("__siteUrl", self.url)
35
-
36
- def _site_loaded(return_type):
37
- self._resource_path = KeyPath(site.id, self.parent_collection.resource_path)
36
+ def _update():
38
37
  super(SiteProperties, self).update()
39
38
 
40
- self.context.load(site, after_loaded=_site_loaded)
39
+ self._ensure_site_path(_update)
41
40
  return self
42
41
 
42
+ def update_ex(self):
43
+ """Updates the site collection properties with the new properties specified in the SiteProperties object."""
44
+ return_type = SpoOperation(self.context)
45
+
46
+ def _update_ex():
47
+ qry = ServiceOperationQuery(
48
+ self, "Update", parameters_type=self, return_type=return_type
49
+ )
50
+ self.context.add_query(qry)
51
+
52
+ self._ensure_site_path(_update_ex)
53
+ return return_type
54
+
43
55
  @property
44
56
  def deny_add_and_customize_pages(self):
45
- """
46
- Represents the status of the [DenyAddAndCustomizePages] feature on a site collection.
47
- """
57
+ # type: () -> Optional[int]
58
+ """Represents the status of the [DenyAddAndCustomizePages] feature on a site collection."""
48
59
  return self.properties.get(
49
60
  "DenyAddAndCustomizePages", DenyAddAndCustomizePagesStatus.Unknown
50
61
  )
51
62
 
52
63
  @deny_add_and_customize_pages.setter
53
64
  def deny_add_and_customize_pages(self, value):
54
- """
55
- Sets the status of the [DenyAddAndCustomizePages] feature on a site collection.
56
-
57
- :param int value:
58
- """
65
+ # type: (int) -> None
66
+ """Sets the status of the [DenyAddAndCustomizePages] feature on a site collection."""
59
67
  self.set_property("DenyAddAndCustomizePages", value)
60
68
 
61
69
  @property
62
70
  def owner_login_name(self):
63
- """
64
- :rtype: str
65
- """
71
+ # type: () -> Optional[str]
66
72
  return self.properties.get("OwnerLoginName", None)
67
73
 
68
74
  @property
69
75
  def webs_count(self):
70
- """
71
- Gets the number of Web objects in the site.
72
- :rtype: int
73
- """
76
+ # type: () -> Optional[str]
77
+ """Gets the number of Web objects in the site."""
74
78
  return self.properties.get("WebsCount", None)
75
79
 
76
80
  @property
77
81
  def url(self):
78
82
  # type: () -> Optional[str]
79
- """
80
- Gets the URL of the site.
81
- """
83
+ """Gets the URL of the site."""
82
84
  return self.properties.get("Url", None)
83
85
 
84
86
  @property
85
87
  def compatibility_level(self):
86
88
  # type: () -> Optional[str]
87
- """
88
- Gets the compatibility level of the site.
89
- """
89
+ """Gets the compatibility level of the site."""
90
90
  return self.properties.get("CompatibilityLevel", None)
91
91
 
92
92
  @property
93
93
  def lock_state(self):
94
94
  # type: () -> Optional[str]
95
- """
96
- Gets or sets the lock state of the site.
97
- """
95
+ """Gets or sets the lock state of the site."""
98
96
  return self.properties.get("LockState", None)
99
97
 
100
98
  @property
101
99
  def sharing_capability(self):
100
+ # type: () -> Optional[int]
102
101
  """
103
102
  Determines what level of sharing is available for the site.
104
103
 
@@ -115,29 +114,41 @@ class SiteProperties(Entity):
115
114
 
116
115
  @sharing_capability.setter
117
116
  def sharing_capability(self, value):
118
- """
119
- Sets the level of sharing for the site.
120
- :type value: int
121
- """
117
+ # type: (int) -> None
118
+ """Sets the level of sharing for the site."""
122
119
  self.set_property("SharingCapability", value)
123
120
 
124
121
  @property
125
122
  def time_zone_id(self):
126
123
  # type: () -> Optional[str]
127
- """
128
- Gets the time zone ID of the site.
129
- """
124
+ """Gets the time zone ID of the site."""
130
125
  return self.properties.get("TimeZoneId", None)
131
126
 
132
127
  @property
133
128
  def entity_type_name(self):
129
+ # type: () -> str
134
130
  return "Microsoft.Online.SharePoint.TenantAdministration.SiteProperties"
135
131
 
136
132
  def set_property(self, name, value, persist_changes=True):
137
133
  super(SiteProperties, self).set_property(name, value, persist_changes)
138
134
  # fallback: create a new resource path
139
135
  if name == "Url" and self._resource_path is None:
140
- self._resource_path = ServiceOperationPath(
136
+ self._resource_path = StaticOperationPath(
141
137
  self.entity_type_name, {"Url": value}
142
138
  )
143
139
  return self
140
+
141
+ def _ensure_site_path(self, action):
142
+ if isinstance(self.resource_path, ServiceOperationPath):
143
+
144
+ def _loaded(return_type):
145
+ # type: (ListItem) -> None
146
+ site_id = return_type.get_property("SiteId")
147
+ self._resource_path = EntityPath(
148
+ site_id, self.parent_collection.resource_path
149
+ )
150
+ action()
151
+
152
+ self.context.tenant.get_site(self.url).after_execute(_loaded)
153
+ else:
154
+ action()
@@ -1,6 +1,8 @@
1
1
  import time
2
2
  from typing import AnyStr, Optional
3
3
 
4
+ from typing_extensions import Self
5
+
4
6
  from office365.runtime.client_result import ClientResult
5
7
  from office365.runtime.client_value_collection import ClientValueCollection
6
8
  from office365.runtime.paths.resource_path import ResourcePath
@@ -9,6 +11,7 @@ from office365.sharepoint.entity import Entity
9
11
  from office365.sharepoint.entity_collection import EntityCollection
10
12
  from office365.sharepoint.gtp.request_options import ChatGptRequestOptions
11
13
  from office365.sharepoint.listitems.collection import ListItemCollection
14
+ from office365.sharepoint.listitems.listitem import ListItem
12
15
  from office365.sharepoint.lists.render_data_parameters import RenderListDataParameters
13
16
  from office365.sharepoint.lists.render_override_parameters import (
14
17
  RenderListDataOverrideParameters,
@@ -19,6 +22,9 @@ from office365.sharepoint.sites.site import Site
19
22
  from office365.sharepoint.tenant.administration.collaboration.insights_data import (
20
23
  CollaborationInsightsData,
21
24
  )
25
+ from office365.sharepoint.tenant.administration.collaboration.insights_overview import (
26
+ CollaborationInsightsOverview,
27
+ )
22
28
  from office365.sharepoint.tenant.administration.hubsites.properties import (
23
29
  HubSiteProperties,
24
30
  )
@@ -139,6 +145,18 @@ class Tenant(Entity):
139
145
  self.context.add_query(qry)
140
146
  return return_type
141
147
 
148
+ def get_collaboration_insights_overview(self):
149
+ """"""
150
+ return_type = ClientResult[CollaborationInsightsData](
151
+ self.context, CollaborationInsightsOverview()
152
+ )
153
+
154
+ qry = ServiceOperationQuery(
155
+ self, "GetCollaborationInsightsOverview", None, None, None, return_type
156
+ )
157
+ self.context.add_query(qry)
158
+ return return_type
159
+
142
160
  def render_recent_admin_actions(self):
143
161
  return_type = ClientResult(self.context)
144
162
  payload = {
@@ -189,7 +207,8 @@ class Tenant(Entity):
189
207
  def get_home_sites(self):
190
208
  # type: () -> ClientResult[ClientValueCollection[HomeSitesDetails]]
191
209
  return_type = ClientResult(
192
- self.context, ClientValueCollection[HomeSitesDetails]()
210
+ self.context,
211
+ ClientValueCollection(HomeSitesDetails), # pylint: disable=E1120
193
212
  )
194
213
  qry = ServiceOperationQuery(self, "GetHomeSites", None, None, None, return_type)
195
214
  self.context.add_query(qry)
@@ -294,14 +313,11 @@ class Tenant(Entity):
294
313
  self.context.add_query(qry)
295
314
  return return_type
296
315
 
297
- def get_site_status(self, url):
298
- """
299
- :param str url:
300
- """
301
- result = self.aggregated_site_collections_list.items.filter(
302
- "SiteUrl eq '{0}'".format(url)
316
+ def get_site(self, site_url):
317
+ # type: (str) -> ListItem
318
+ return self._aggregated_site_collections_list.items.single(
319
+ "SiteUrl eq '{0}'".format(site_url.rstrip("/"))
303
320
  ).get()
304
- return result
305
321
 
306
322
  def get_sites_by_state(self, states=None):
307
323
  """
@@ -309,7 +325,7 @@ class Tenant(Entity):
309
325
  """
310
326
  return_type = ListItemCollection(
311
327
  self.context,
312
- ResourcePath("items", self.aggregated_site_collections_list.resource_path),
328
+ ResourcePath("items", self._aggregated_site_collections_list.resource_path),
313
329
  )
314
330
  payload = {"states": states}
315
331
  qry = ServiceOperationQuery(
@@ -318,6 +334,26 @@ class Tenant(Entity):
318
334
  self.context.add_query(qry)
319
335
  return return_type
320
336
 
337
+ def _poll_site_status(self, site_url, polling_interval_secs):
338
+ states = [0, 1, 2]
339
+ time.sleep(polling_interval_secs)
340
+
341
+ def _after(items):
342
+ completed = (
343
+ len(
344
+ [
345
+ item
346
+ for item in items
347
+ if item.properties.get("SiteUrl") == site_url
348
+ ]
349
+ )
350
+ > 0
351
+ )
352
+ if not completed:
353
+ self._poll_site_status(site_url, polling_interval_secs)
354
+
355
+ self.get_sites_by_state(states).after_execute(_after, execute_first=True)
356
+
321
357
  def get_site_health_status(self, source_url):
322
358
  """
323
359
  :type source_url: str
@@ -388,12 +424,8 @@ class Tenant(Entity):
388
424
  return self
389
425
 
390
426
  def register_hub_site(self, site_url):
391
- """
392
- Registers an existing site as a hub site.
393
-
394
- :param str site_url:
395
- :return:
396
- """
427
+ # type: (str) -> HubSiteProperties
428
+ """Registers an existing site as a hub site."""
397
429
  return_type = HubSiteProperties(self.context)
398
430
  params = {"siteUrl": site_url}
399
431
  qry = ServiceOperationQuery(
@@ -403,11 +435,8 @@ class Tenant(Entity):
403
435
  return return_type
404
436
 
405
437
  def unregister_hub_site(self, site_url):
406
- """
407
- Unregisters a hub site so that it is no longer a hub site.
408
-
409
- :param str site_url: Site Url
410
- """
438
+ # type: (str) -> Self
439
+ """Unregisters a hub site so that it is no longer a hub site."""
411
440
  payload = {"siteUrl": site_url}
412
441
  qry = ServiceOperationQuery(
413
442
  self, "UnregisterHubSite", None, payload, None, None
@@ -437,39 +466,19 @@ class Tenant(Entity):
437
466
  def create_site_sync(self, url, owner, title=None):
438
467
  """Creates a site collection
439
468
 
440
- :param str title: Sets the new site’s title.
469
+ :param str title: Sets the new site’s title.
441
470
  :param str url: Sets the new site’s URL.
442
471
  :param str owner: Sets the login name of the owner of the new site.
443
472
  """
444
473
  return_type = Site(self.context)
445
- op = self.create_site(url, owner, title)
446
-
447
- def _verify_site_status(resp, items=None):
448
- """
449
- :type resp: requests.Response
450
- """
451
- resp.raise_for_status()
452
- if items is None:
453
- is_complete = op.is_complete
454
- else:
455
- is_complete = (
456
- len(
457
- [
458
- item
459
- for item in items
460
- if item.properties.get("SiteUrl") == url
461
- ]
462
- )
463
- > 0
464
- )
465
- if not is_complete:
466
- time.sleep(op.polling_interval_secs)
467
- items = self.get_sites_by_state([0, 1, 2])
468
- self.context.after_execute(_verify_site_status, items=items)
474
+ return_type.set_property("__siteUrl", url)
469
475
 
470
- return_type.set_property("__siteUrl", url)
476
+ def _ensure_status(op):
477
+ # type: (SpoOperation) -> None
478
+ if not op.is_complete:
479
+ self._poll_site_status(url, op.polling_interval_secs)
471
480
 
472
- self.context.after_execute(_verify_site_status)
481
+ self.create_site(url, owner, title).after_execute(_ensure_status)
473
482
  return return_type
474
483
 
475
484
  def remove_site(self, site_url):
@@ -511,7 +520,6 @@ class Tenant(Entity):
511
520
 
512
521
  def restore_deleted_site(self, site_url):
513
522
  """Restores deleted site with the specified URL
514
-
515
523
  :param str site_url: A string representing the URL of the site.
516
524
  """
517
525
  return_type = SpoOperation(self.context)
@@ -528,6 +536,7 @@ class Tenant(Entity):
528
536
  :param bool include_detail: A Boolean value that indicates whether to include all of the SPSite properties.
529
537
  """
530
538
  return_type = SiteProperties(self.context)
539
+ return_type.set_property("Url", url, False)
531
540
  self.sites.add_child(return_type)
532
541
  payload = {"url": url, "includeDetail": include_detail}
533
542
  qry = ServiceOperationQuery(
@@ -559,12 +568,8 @@ class Tenant(Entity):
559
568
  return return_type
560
569
 
561
570
  def connect_site_to_hub_site_by_id(self, site_url, hub_site_id):
562
- """
563
-
564
- :param str site_url:
565
- :param str hub_site_id:
566
- :return:
567
- """
571
+ # type: (str, str) -> Self
572
+ """Connects Site to Hub Site"""
568
573
  params = {"siteUrl": site_url, "hubSiteId": hub_site_id}
569
574
  qry = ServiceOperationQuery(
570
575
  self, "ConnectSiteToHubSiteById", None, params, None, None
@@ -573,9 +578,8 @@ class Tenant(Entity):
573
578
  return self
574
579
 
575
580
  def send_email(self, site_url):
576
- """
577
- :type site_url: str
578
- """
581
+ # type: (str) -> ClientResult[bool]
582
+ """ """
579
583
  return_type = ClientResult(self.context, bool())
580
584
  payload = {"siteUrl": site_url}
581
585
  qry = ServiceOperationQuery(self, "SendEmail", None, payload, None, return_type)
@@ -584,10 +588,8 @@ class Tenant(Entity):
584
588
 
585
589
  @property
586
590
  def ai_builder_enabled(self):
587
- """
588
- Gets the value if the AIBuilder settings should be shown in the tenant
589
- :rtype: bool or None
590
- """
591
+ # type: () -> Optional[str]
592
+ """Gets the value if the AIBuilder settings should be shown in the tenant"""
591
593
  return self.properties.get("AIBuilderEnabled", None)
592
594
 
593
595
  @property
@@ -598,26 +600,26 @@ class Tenant(Entity):
598
600
  )
599
601
 
600
602
  @property
601
- def aggregated_site_collections_list(self):
603
+ def _aggregated_site_collections_list(self):
602
604
  return self.context.web.lists.get_by_title(
603
605
  "DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS"
604
606
  )
605
607
 
606
608
  @property
607
609
  def allow_comments_text_on_email_enabled(self):
610
+ # type: () -> Optional[bool]
608
611
  """
609
612
  When enabled, the email notification that a user receives when is mentioned,
610
- includes the surrounding document context
611
- :rtype: bool or None
613
+ includes the surrounding document context
612
614
  """
613
615
  return self.properties.get("AllowCommentsTextOnEmailEnabled", None)
614
616
 
615
617
  @property
616
618
  def allow_everyone_except_external_users_claim_in_private_site(self):
619
+ # type: () -> Optional[bool]
617
620
  """
618
621
  Gets the value if EveryoneExceptExternalUsers claim is allowed or not in people picker in a private group site.
619
622
  False value means it is blocked
620
- :rtype: bool or None
621
623
  """
622
624
  return self.properties.get(
623
625
  "AllowEveryoneExceptExternalUsersClaimInPrivateSite", None
@@ -625,10 +627,10 @@ class Tenant(Entity):
625
627
 
626
628
  @property
627
629
  def allow_editing(self):
630
+ # type: () -> Optional[bool]
628
631
  """
629
632
  Prevents users from editing Office files in the browser and copying and pasting Office file contents
630
633
  out of the browser window.
631
- :rtype: bool or None
632
634
  """
633
635
  return self.properties.get("AllowEditing", None)
634
636
 
@@ -640,9 +642,7 @@ class Tenant(Entity):
640
642
  @property
641
643
  def root_site_url(self):
642
644
  # type: () -> Optional[str]
643
- """
644
- The tenant's root site url
645
- """
645
+ """The tenant's root site url"""
646
646
  return self.properties.get("RootSiteUrl", None)
647
647
 
648
648
  @property
@@ -44,7 +44,7 @@ class ResourcePath(ClientValue):
44
44
  return "SP.ResourcePath"
45
45
 
46
46
  def __str__(self):
47
- return str(self.DecodedUrl)
47
+ return self.DecodedUrl
48
48
 
49
49
  def __repr__(self):
50
- return str(self.DecodedUrl)
50
+ return self.DecodedUrl or self.entity_type_name
@@ -24,7 +24,7 @@ class ClientPeoplePickerQueryParameters(ClientValue):
24
24
  Specifies the properties of a principal query
25
25
 
26
26
  :type int urlZone: Specifies a location in the topology of the farm for the principal query.
27
- :param int sharepoint_group_id: specifies a group containing allowed principals to be used in the principal query.
27
+ :param int sharepoint_group_id: specifies a group containing allowed principals to be used in the principal query
28
28
  :param str query_string: Specifies the value to be used in the principal query.
29
29
  :param int principal_type: Specifies the type to be used in the principal query.
30
30
  :param int principal_source: Specifies the source to be used in the principal query.
@@ -3,7 +3,7 @@ from office365.sharepoint.entity_collection import EntityCollection
3
3
  from office365.sharepoint.usercustomactions.action import UserCustomAction
4
4
 
5
5
 
6
- class UserCustomActionCollection(EntityCollection):
6
+ class UserCustomActionCollection(EntityCollection[UserCustomAction]):
7
7
  def __init__(self, context, resource_path=None):
8
8
  """Specifies a collection of custom actions."""
9
9
  super(UserCustomActionCollection, self).__init__(
@@ -13,7 +13,6 @@ class UserCustomActionCollection(EntityCollection):
13
13
  def clear(self):
14
14
  """
15
15
  Deletes all custom actions in the collection.
16
-
17
16
  Exceptions:
18
17
  - 2130575305 Microsoft.SharePoint.SPException Custom action was modified on the server in a way that
19
18
  prevents changes from being committed, as determined by the protocol server.
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.queries.service_operation import ServiceOperationQuery
2
4
  from office365.sharepoint.entity import Entity
3
5
 
@@ -23,22 +25,20 @@ class MySiteLinks(Entity):
23
25
 
24
26
  @property
25
27
  def all_documents_link(self):
28
+ # type: () -> Optional[str]
26
29
  """
27
30
  This property value is the URL of the user’s document library on their personal site. This property value is
28
31
  null if the user does not have a personal site or the user does not have a document library in their personal
29
32
  site.
30
-
31
- :rtype: str
32
33
  """
33
34
  return self.properties.get("AllDocumentsLink", None)
34
35
 
35
36
  @property
36
37
  def all_sites_link(self):
38
+ # type: () -> Optional[str]
37
39
  """
38
40
  This property value is the URL of the user’s followed sites view on their personal site. This property value
39
41
  is null if the user does not have a personal site or social features are not enabled on their personal site.
40
-
41
- :rtype: str
42
42
  """
43
43
  return self.properties.get("AllSitesLink", None)
44
44
 
@@ -95,7 +95,7 @@ class PeopleManager(Entity):
95
95
  :param str account_name: Account name of the specified user.
96
96
  :param str site_id: Site Identifier.
97
97
  """
98
- return_type = ClientResult(self.context, dict())
98
+ return_type = ClientResult(self.context, {})
99
99
  params = {"accountName": account_name, "siteId": site_id}
100
100
  qry = ServiceOperationQuery(
101
101
  self, "GetSPUserInformation", params, None, None, return_type
@@ -157,9 +157,7 @@ class PeopleManager(Entity):
157
157
  def get_properties_for(self, user_or_name):
158
158
  """
159
159
  Gets user properties for the specified user.
160
-
161
160
  :param str or User user_or_name: Specifies the User object or its login name.
162
- :return: PersonProperties
163
161
  """
164
162
  return_type = PersonProperties(self.context)
165
163