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,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.client_result import ClientResult
2
4
  from office365.runtime.paths.resource_path import ResourcePath
3
5
  from office365.runtime.queries.service_operation import ServiceOperationQuery
@@ -12,41 +14,37 @@ class UserProfile(Entity):
12
14
 
13
15
  @property
14
16
  def account_name(self):
15
- """
16
- The account name of the user.
17
- :rtype: str or None
18
- """
17
+ # type: () -> Optional[str]
18
+ """The account name of the user."""
19
19
  return self.properties.get("AccountName", None)
20
20
 
21
21
  @property
22
22
  def display_name(self):
23
- """
24
- The title of the user.
25
- :rtype: str or None
26
- """
23
+ # type: () -> Optional[str]
24
+ """The title of the user."""
27
25
  return self.properties.get("DisplayName", None)
28
26
 
29
27
  @property
30
28
  def my_site_host_url(self):
29
+ # type: () -> Optional[str]
31
30
  """
32
31
  Specifies the URL for the personal site of the current user.
33
- :rtype: str or None
34
32
  """
35
33
  return self.properties.get("MySiteHostUrl", None)
36
34
 
37
35
  @property
38
36
  def public_url(self):
37
+ # type: () -> Optional[str]
39
38
  """
40
39
  Specifies the public URL for the personal site of the current user.
41
- :rtype: str or None
42
40
  """
43
41
  return self.properties.get("PublicUrl", None)
44
42
 
45
43
  @property
46
44
  def url_to_create_personal_site(self):
45
+ # type: () -> Optional[str]
47
46
  """
48
47
  The UrlToCreatePersonalSite property specifies the URL to allow the current user to create a personal site.
49
- :rtype: str or None
50
48
  """
51
49
  return self.properties.get("UrlToCreatePersonalSite", None)
52
50
 
@@ -1,4 +1,6 @@
1
1
  from office365.runtime.client_value import ClientValue
2
+ from office365.runtime.odata.type import ODataType
3
+ from office365.sharepoint.principal.type import PrincipalType
2
4
 
3
5
 
4
6
  class PrincipalInfo(ClientValue):
@@ -12,6 +14,7 @@ class PrincipalInfo(ClientValue):
12
14
  login_name=None,
13
15
  department=None,
14
16
  job_title=None,
17
+ principal_type=None,
15
18
  ):
16
19
  """
17
20
  :param str principal_id: Specifies an identifier for the principal. It MUST be -1 if the principal
@@ -21,6 +24,7 @@ class PrincipalInfo(ClientValue):
21
24
  :param str department: Specifies the department name of the principal.
22
25
  :param str job_title: Specifies the job title of the principal.
23
26
  :param str login_name: Specifies the login name of the principal.
27
+ :param int principal_type: Specifies the principal type.
24
28
  """
25
29
  self.PrincipalId = principal_id
26
30
  self.DisplayName = display_name
@@ -28,7 +32,15 @@ class PrincipalInfo(ClientValue):
28
32
  self.LoginName = login_name
29
33
  self.Department = department
30
34
  self.JobTitle = job_title
35
+ self.PrincipalType = principal_type
31
36
 
32
37
  @property
33
38
  def entity_type_name(self):
34
39
  return "SP.Utilities.PrincipalInfo"
40
+
41
+ @property
42
+ def principal_type_name(self):
43
+ return ODataType.resolve_enum_key(PrincipalType, self.PrincipalType)
44
+
45
+ def __str__(self):
46
+ return "{0}: {1}".format(self.principal_type_name, self.DisplayName)
@@ -26,7 +26,7 @@ class EmployeeEngagement(Entity):
26
26
  return return_type
27
27
 
28
28
  def viva_home_configuration(self):
29
- return_type = ClientResult(self.context, dict())
29
+ return_type = ClientResult(self.context, {})
30
30
  qry = FunctionQuery(self, "VivaHomeConfiguration", None, return_type)
31
31
  self.context.add_query(qry)
32
32
  return return_type
@@ -3,7 +3,7 @@ from office365.sharepoint.entity_collection import EntityCollection
3
3
  from office365.sharepoint.webparts.definition import WebPartDefinition
4
4
 
5
5
 
6
- class WebPartDefinitionCollection(EntityCollection):
6
+ class WebPartDefinitionCollection(EntityCollection[WebPartDefinition]):
7
7
  """Implements a collection of Web Part definition objects"""
8
8
 
9
9
  def __init__(self, context, resource_path=None):
@@ -1,5 +1,6 @@
1
1
  from office365.runtime.queries.service_operation import ServiceOperationQuery
2
2
  from office365.sharepoint.entity_collection import EntityCollection
3
+ from office365.sharepoint.internal.paths.web import WebPath
3
4
  from office365.sharepoint.webs.web import Web
4
5
 
5
6
 
@@ -25,6 +26,13 @@ class WebCollection(EntityCollection[Web]):
25
26
  self.context.add_query(qry)
26
27
  return return_type
27
28
 
29
+ def create_typed_object(self, initial_properties=None, resource_path=None):
30
+ if resource_path is None:
31
+ resource_path = WebPath(self.resource_path)
32
+ return super(EntityCollection, self).create_typed_object(
33
+ initial_properties, resource_path
34
+ )
35
+
28
36
  @property
29
37
  def resource_url(self):
30
38
  val = super(WebCollection, self).resource_url
@@ -3,7 +3,7 @@ from office365.sharepoint.entity_collection import EntityCollection
3
3
  from office365.sharepoint.webs.template import WebTemplate
4
4
 
5
5
 
6
- class WebTemplateCollection(EntityCollection):
6
+ class WebTemplateCollection(EntityCollection[WebTemplate]):
7
7
  """Specifies a collection of site templates."""
8
8
 
9
9
  def __init__(self, context, resource_path=None, parent=None):
@@ -12,10 +12,8 @@ class WebTemplateCollection(EntityCollection):
12
12
  )
13
13
 
14
14
  def get_by_name(self, name):
15
- """Returns the SP.WebTemplate (section 3.2.5.151) specified by its name.<162>
16
-
17
- :param str name: The name of the SP.WebTemplate that is returned.
18
-
15
+ """Returns the SP.WebTemplate (section 3.2.5.151) specified by its name.
16
+ :param str name: The name of the WebTemplate that is returned.
19
17
  """
20
18
  return WebTemplate(
21
19
  self.context,
@@ -1,6 +1,6 @@
1
1
  # coding=utf-8
2
2
  import datetime
3
- from typing import Optional
3
+ from typing import AnyStr, Optional
4
4
 
5
5
  from office365.runtime.client_result import ClientResult
6
6
  from office365.runtime.client_value_collection import ClientValueCollection
@@ -16,6 +16,7 @@ from office365.sharepoint.authentication.acs_service_principal_info import (
16
16
  )
17
17
  from office365.sharepoint.businessdata.app_bdc_catalog import AppBdcCatalog
18
18
  from office365.sharepoint.changes.collection import ChangeCollection
19
+ from office365.sharepoint.changes.query import ChangeQuery
19
20
  from office365.sharepoint.clientsidecomponent.hostedapps.manager import (
20
21
  HostedAppsManager,
21
22
  )
@@ -40,6 +41,7 @@ from office365.sharepoint.files.file import File
40
41
  from office365.sharepoint.flows.synchronization_result import FlowSynchronizationResult
41
42
  from office365.sharepoint.folders.collection import FolderCollection
42
43
  from office365.sharepoint.folders.folder import Folder
44
+ from office365.sharepoint.internal.paths.web import WebPath
43
45
  from office365.sharepoint.listitems.listitem import ListItem
44
46
  from office365.sharepoint.lists.collection import ListCollection
45
47
  from office365.sharepoint.lists.creation_information import ListCreationInformation
@@ -122,10 +124,13 @@ class Web(SecurableObject):
122
124
  :type context: office365.sharepoint.client_context.ClientContext
123
125
  """
124
126
  if resource_path is None:
125
- resource_path = ResourcePath("Web")
127
+ resource_path = WebPath("Web")
126
128
  super(Web, self).__init__(context, resource_path)
127
129
  self._web_url = None
128
130
 
131
+ def __str__(self):
132
+ return self.title
133
+
129
134
  def add_list(self, title, template_type=ListTemplateType.GenericList):
130
135
  """
131
136
  Creates a new list and adds it to the web.
@@ -575,7 +580,7 @@ class Web(SecurableObject):
575
580
  :type webs: office365.sharepoint.webs.collection.WebCollection
576
581
  :type all_webs: office365.sharepoint.webs.collection.WebCollection
577
582
  """
578
- for cur_web in webs: # type: Web
583
+ for cur_web in webs:
579
584
  all_webs.add_child(cur_web)
580
585
 
581
586
  def _webs_loaded(web):
@@ -698,7 +703,7 @@ class Web(SecurableObject):
698
703
  :param str url: The URL of the site, with the path of the object in SharePoint represented as query
699
704
  string parameters
700
705
  :param office365.sharepoint.client_context.ClientContext context: client context
701
- :param ClientResult return_type: Return type
706
+ :param ClientResult[str] return_type: Return type
702
707
  """
703
708
  if return_type is None:
704
709
  return_type = ClientResult(context, str())
@@ -814,6 +819,7 @@ class Web(SecurableObject):
814
819
  ServiceOperationPath(
815
820
  "getFileByServerRelativeUrl", [str(path)], self.resource_path
816
821
  ),
822
+ self.root_folder.files,
817
823
  )
818
824
 
819
825
  def get_file_by_server_relative_path(self, path):
@@ -830,6 +836,7 @@ class Web(SecurableObject):
830
836
  ServiceOperationPath(
831
837
  "getFileByServerRelativePath", path.to_json(), self.resource_path
832
838
  ),
839
+ self.root_folder.files,
833
840
  )
834
841
 
835
842
  def get_folder_by_server_relative_url(self, url):
@@ -842,6 +849,7 @@ class Web(SecurableObject):
842
849
  ServiceOperationPath(
843
850
  "getFolderByServerRelativeUrl", [url], self.resource_path
844
851
  ),
852
+ self.folders,
845
853
  )
846
854
 
847
855
  def get_folder_by_server_relative_path(self, decoded_url):
@@ -858,6 +866,7 @@ class Web(SecurableObject):
858
866
  ServiceOperationPath(
859
867
  "getFolderByServerRelativePath", path.to_json(), self.resource_path
860
868
  ),
869
+ self.folders,
861
870
  )
862
871
 
863
872
  def get_site_page_copy_to_status(self, work_item_id):
@@ -887,7 +896,6 @@ class Web(SecurableObject):
887
896
  def ensure_folder_path(self, path):
888
897
  """
889
898
  Ensures a nested folder hierarchy exist
890
-
891
899
  :param str path: relative server URL (path) to a folder
892
900
  """
893
901
  return self.root_folder.folders.ensure_path(path)
@@ -930,18 +938,6 @@ class Web(SecurableObject):
930
938
  self.context.add_query(qry)
931
939
  return return_type
932
940
 
933
- def get_user_effective_permissions(self, user_name):
934
- """Gets the effective permissions that the specified user has within the current application scope.
935
-
936
- :param str user_name: Specifies the user login name.
937
- """
938
- return_type = ClientResult(self.context, BasePermissions())
939
- qry = ServiceOperationQuery(
940
- self, "GetUserEffectivePermissions", [user_name], None, None, return_type
941
- )
942
- self.context.add_query(qry)
943
- return return_type
944
-
945
941
  def get_list_by_title(self, title):
946
942
  """
947
943
  Returns the list with the specified display name.
@@ -1019,12 +1015,14 @@ class Web(SecurableObject):
1019
1015
  ServiceOperationPath("getList", [str(safe_path)], self.resource_path),
1020
1016
  )
1021
1017
 
1022
- def get_changes(self, query):
1023
- """Returns the collection of all changes from the change log that have occurred within the scope of the site,
1018
+ def get_changes(self, query=None):
1019
+ """Returns the collection of all changes from the change log that have occurred within the scope of the web,
1024
1020
  based on the specified query.
1025
1021
 
1026
1022
  :param office365.sharepoint.changes.query.ChangeQuery query: Specifies which changes to return
1027
1023
  """
1024
+ if query is None:
1025
+ query = ChangeQuery(web=True, fetch_limit=100)
1028
1026
  return_type = ChangeCollection(self.context)
1029
1027
  payload = {"query": query}
1030
1028
  qry = ServiceOperationQuery(
@@ -1104,7 +1102,6 @@ class Web(SecurableObject):
1104
1102
  def get_file_by_guest_url(self, guest_url):
1105
1103
  """
1106
1104
  Returns the file object from the guest access URL.
1107
-
1108
1105
  :param str guest_url: The guest access URL to get the file with.
1109
1106
  """
1110
1107
  return_type = File(self.context)
@@ -1207,7 +1204,7 @@ class Web(SecurableObject):
1207
1204
 
1208
1205
  :param str guest_url: The tokenized sharing link URL for the folder.
1209
1206
  """
1210
- return_type = Folder(self.context)
1207
+ return_type = Folder(self.context, parent_collection=self.folders)
1211
1208
  payload = {"guestUrl": guest_url}
1212
1209
  qry = ServiceOperationQuery(
1213
1210
  self, "GetFolderByGuestUrl", None, payload, None, return_type
@@ -1231,7 +1228,7 @@ class Web(SecurableObject):
1231
1228
  :param bool ensure_access: Indicates if the request to the tokenized sharing link grants perpetual access to
1232
1229
  the calling user.
1233
1230
  """
1234
- return_type = Folder(self.context)
1231
+ return_type = Folder(self.context, parent_collection=self.folders)
1235
1232
  payload = {
1236
1233
  "guestUrl": guest_url,
1237
1234
  "requestSettings": SharingLinkAccessRequest(ensure_access, password),
@@ -1285,13 +1282,13 @@ class Web(SecurableObject):
1285
1282
  :param bool send_email: A flag to determine if an email notification SHOULD be sent (if email is configured).
1286
1283
  :param str email_subject: The email subject.
1287
1284
  :param str email_body: The email subject.
1288
- :rtype: SharingResult
1289
1285
  """
1290
1286
  return_type = SharingResult(self.context)
1291
1287
 
1292
- def _picker_value_resolved(resp, picker_result, group):
1288
+ def _share(picker_result, group):
1289
+ # type: (ClientResult[str], Group) -> None
1293
1290
  picker_input = "[{0}]".format(picker_result.value)
1294
- role_value = "group:{groupId}".format(groupId=group.properties["Id"])
1291
+ role_value = "group:{groupId}".format(groupId=group.id)
1295
1292
  Web.share_object(
1296
1293
  self.context,
1297
1294
  self.url,
@@ -1306,34 +1303,30 @@ class Web(SecurableObject):
1306
1303
  return_type=return_type,
1307
1304
  )
1308
1305
 
1309
- def _grp_resolved(group):
1310
- picker_result = (
1311
- ClientPeoplePickerWebServiceInterface.client_people_picker_resolve_user(
1312
- self.context, user_principal_name
1313
- )
1314
- )
1315
- self.context.after_execute(
1316
- _picker_value_resolved, True, picker_result, group
1317
- )
1318
-
1319
1306
  def _web_resolved():
1320
1307
  groups = {
1321
1308
  ExternalSharingSiteOption.View: self.associated_visitor_group,
1322
1309
  ExternalSharingSiteOption.Edit: self.associated_member_group,
1323
1310
  ExternalSharingSiteOption.Owner: self.associated_owner_group,
1324
- }
1325
- selected_group = groups[share_option]
1326
- self.context.load(selected_group, after_loaded=_grp_resolved)
1311
+ } # type: dict[ExternalSharingSiteOption, Group]
1327
1312
 
1328
- self.ensure_property("Url", _web_resolved)
1313
+ ClientPeoplePickerWebServiceInterface.client_people_picker_resolve_user(
1314
+ self.context, user_principal_name
1315
+ ).after_execute(_share, groups[share_option])
1316
+
1317
+ self.ensure_properties(
1318
+ [
1319
+ "Url",
1320
+ "AssociatedVisitorGroup",
1321
+ "AssociatedMemberGroup",
1322
+ "AssociatedOwnerGroup",
1323
+ ],
1324
+ _web_resolved,
1325
+ )
1329
1326
  return return_type
1330
1327
 
1331
1328
  def unshare(self):
1332
- """
1333
- Removes Sharing permissions on a Web
1334
-
1335
- :rtype: SharingResult
1336
- """
1329
+ """Removes Sharing permissions on a Web"""
1337
1330
  return_type = SharingResult(self.context)
1338
1331
 
1339
1332
  def _web_initialized():
@@ -1602,12 +1595,12 @@ class Web(SecurableObject):
1602
1595
  )
1603
1596
 
1604
1597
  def get_list_item(self, str_url):
1598
+ # type: (str) -> ListItem
1605
1599
  """
1606
1600
  Returns the list item that is associated with the specified server-relative URL.
1607
1601
 
1608
1602
  :param str str_url: A string that contains the server-relative URL,
1609
1603
  for example, "/sites/MySite/Shared Documents/MyDocument.docx".
1610
- :return: ListItem
1611
1604
  """
1612
1605
  return ListItem(
1613
1606
  self.context,
@@ -1615,12 +1608,12 @@ class Web(SecurableObject):
1615
1608
  )
1616
1609
 
1617
1610
  def get_list_item_using_path(self, decoded_url):
1611
+ # type: (str) -> ListItem
1618
1612
  """
1619
1613
  Returns the list item that is associated with the specified server-relative path.
1620
1614
 
1621
1615
  :param str decoded_url: A string that contains the server-relative path,
1622
1616
  for example, "/sites/MySite/Shared Documents/MyDocument.docx" or "Shared Documents/MyDocument.docx".
1623
- :return: ListItem
1624
1617
  """
1625
1618
  params = SPResPath.create_relative(self.context.base_url, decoded_url)
1626
1619
  return ListItem(
@@ -1639,6 +1632,7 @@ class Web(SecurableObject):
1639
1632
  )
1640
1633
 
1641
1634
  def page_context_info(self, include_odb_settings, emit_navigation_info):
1635
+ # type: (bool, bool) -> ClientResult[AnyStr]
1642
1636
  """
1643
1637
  Return Page context info for the current list being rendered.
1644
1638
 
@@ -1794,6 +1788,7 @@ class Web(SecurableObject):
1794
1788
 
1795
1789
  @property
1796
1790
  def activities(self):
1791
+ # type: () -> EntityCollection[SPActivityEntity]
1797
1792
  return self.properties.get(
1798
1793
  "Activities",
1799
1794
  EntityCollection(
@@ -1815,22 +1810,21 @@ class Web(SecurableObject):
1815
1810
 
1816
1811
  @property
1817
1812
  def allow_rss_feeds(self):
1813
+ # type: () -> Optional[bool]
1818
1814
  """
1819
1815
  Gets a Boolean value that specifies whether the site collection allows RSS feeds.
1820
- :rtype: str
1821
1816
  """
1822
1817
  return self.properties.get("AllowRssFeeds", None)
1823
1818
 
1824
1819
  @property
1825
1820
  def alternate_css_url(self):
1826
- """Gets the URL for an alternate cascading style sheet (CSS) to use in the website.
1827
-
1828
- :rtype: str
1829
- """
1821
+ # type: () -> Optional[str]
1822
+ """Gets the URL for an alternate cascading style sheet (CSS) to use in the website."""
1830
1823
  return self.properties.get("AlternateCssUrl", None)
1831
1824
 
1832
1825
  @property
1833
1826
  def app_instance_id(self):
1827
+ # type: () -> Optional[str]
1834
1828
  """
1835
1829
  Specifies the identifier of the app instance that this site (2) represents. If this site (2) does not
1836
1830
  represent an app instance, then this MUST specify an empty GUID.
@@ -1848,31 +1842,25 @@ class Web(SecurableObject):
1848
1842
 
1849
1843
  @property
1850
1844
  def created(self):
1851
- """
1852
- Specifies when the site was created.
1853
- """
1845
+ # type: () -> datetime.datetime
1846
+ """Specifies when the site was created"""
1854
1847
  return self.properties.get("Created", datetime.datetime.min)
1855
1848
 
1856
1849
  @property
1857
1850
  def custom_master_url(self):
1858
- """Gets the URL for a custom master page to apply to the Web site
1859
- :rtype: str or None
1860
- """
1851
+ # type: () -> Optional[str]
1852
+ """Gets the URL for a custom master page to apply to the Web site"""
1861
1853
  return self.properties.get("CustomMasterUrl", None)
1862
1854
 
1863
1855
  @property
1864
1856
  def custom_site_actions_disabled(self):
1865
- """
1866
- :rtype: bool or None
1867
- """
1857
+ # type: () -> Optional[bool]
1868
1858
  return self.properties.get("CustomSiteActionsDisabled", None)
1869
1859
 
1870
1860
  @property
1871
1861
  def id(self):
1872
- """
1873
- Specifies the site identifier for the site
1874
- :rtype: str
1875
- """
1862
+ # type: () -> Optional[str]
1863
+ """Specifies the site identifier for the site"""
1876
1864
  return self.properties.get("Id", None)
1877
1865
 
1878
1866
  @property
@@ -1885,44 +1873,41 @@ class Web(SecurableObject):
1885
1873
 
1886
1874
  @property
1887
1875
  def access_request_list_url(self):
1888
- """
1889
- :rtype: str or None
1890
- """
1876
+ # type: () -> Optional[str]
1891
1877
  return self.properties.get("AccessRequestListUrl", None)
1892
1878
 
1893
1879
  @property
1894
1880
  def allow_designer_for_current_user(self):
1881
+ # type: () -> Optional[bool]
1895
1882
  """
1896
1883
  Specifies whether the current user is allowed to use a designer application to customize this site
1897
- :rtype: bool or None
1898
1884
  """
1899
1885
  return self.properties.get("AllowDesignerForCurrentUser", None)
1900
1886
 
1901
1887
  @property
1902
1888
  def allow_master_page_editing_for_current_user(self):
1889
+ # type: () -> Optional[bool]
1903
1890
  """
1904
1891
  Specifies whether the current user is allowed to edit the master page.
1905
- :rtype: bool or None
1906
1892
  """
1907
1893
  return self.properties.get("AllowMasterPageEditingForCurrentUser", None)
1908
1894
 
1909
1895
  @property
1910
1896
  def allow_revert_from_template_for_current_user(self):
1897
+ # type: () -> Optional[bool]
1911
1898
  """
1912
1899
  Specifies whether the current user is allowed to revert the site (2) to a default site template.
1913
- :rtype: bool or None
1914
1900
  """
1915
1901
  return self.properties.get("AllowRevertFromTemplateForCurrentUser", None)
1916
1902
 
1917
1903
  @property
1918
1904
  def effective_base_permissions(self):
1919
1905
  """Specifies the effective permissions that are assigned to the current user"""
1920
- from office365.sharepoint.permissions.base_permissions import BasePermissions
1921
-
1922
1906
  return self.properties.get("EffectiveBasePermissions", BasePermissions())
1923
1907
 
1924
1908
  @property
1925
1909
  def enable_minimal_download(self):
1910
+ # type: () -> Optional[bool]
1926
1911
  """
1927
1912
  Specifies whether the site will use the minimal download strategy by default.
1928
1913
 
@@ -1975,6 +1960,7 @@ class Web(SecurableObject):
1975
1960
 
1976
1961
  @property
1977
1962
  def onedrive_shared_items(self):
1963
+ # type: () -> EntityCollection[SharedDocumentInfo]
1978
1964
  """"""
1979
1965
  return self.properties.get(
1980
1966
  "OneDriveSharedItems",
@@ -2027,6 +2013,7 @@ class Web(SecurableObject):
2027
2013
 
2028
2014
  @property
2029
2015
  def associated_visitor_group(self):
2016
+ # type: () -> Group
2030
2017
  """Gets or sets the associated visitor group of the Web site."""
2031
2018
  return self.properties.get(
2032
2019
  "AssociatedVisitorGroup",
@@ -2037,6 +2024,7 @@ class Web(SecurableObject):
2037
2024
 
2038
2025
  @property
2039
2026
  def associated_owner_group(self):
2027
+ # type: () -> Group
2040
2028
  """Gets or sets the associated owner group of the Web site."""
2041
2029
  return self.properties.get(
2042
2030
  "AssociatedOwnerGroup",
@@ -2047,6 +2035,7 @@ class Web(SecurableObject):
2047
2035
 
2048
2036
  @property
2049
2037
  def associated_member_group(self):
2038
+ # type: () -> Group
2050
2039
  """Gets or sets the group of users who have been given contribute permissions to the Web site."""
2051
2040
  return self.properties.get(
2052
2041
  "AssociatedMemberGroup",
@@ -2209,10 +2198,8 @@ class Web(SecurableObject):
2209
2198
 
2210
2199
  @quick_launch_enabled.setter
2211
2200
  def quick_launch_enabled(self, value):
2212
- """Sets a value that specifies whether the Quick Launch area is enabled on the site.
2213
-
2214
- :type value: bool
2215
- """
2201
+ # type: (bool) -> None
2202
+ """Sets a value that specifies whether the Quick Launch area is enabled on the site."""
2216
2203
  self.set_property("QuickLaunchEnabled", value)
2217
2204
 
2218
2205
  @property
@@ -2240,10 +2227,9 @@ class Web(SecurableObject):
2240
2227
 
2241
2228
  @is_multilingual.setter
2242
2229
  def is_multilingual(self, val):
2230
+ # type: (bool) -> None
2243
2231
  """
2244
2232
  Sets whether Multilingual UI is turned on for this web or not.
2245
-
2246
- :type val: bool
2247
2233
  """
2248
2234
  self.set_property("IsMultilingual", val)
2249
2235
 
@@ -2341,6 +2327,7 @@ class Web(SecurableObject):
2341
2327
 
2342
2328
  @property
2343
2329
  def available_content_types(self):
2330
+ # type: () -> ContentTypeCollection
2344
2331
  """
2345
2332
  Specifies the collection of all site content types that apply to the current scope,
2346
2333
  including those of the current site (2), as well as any parent sites.
@@ -2364,19 +2351,14 @@ class Web(SecurableObject):
2364
2351
 
2365
2352
  @property
2366
2353
  def title(self):
2367
- """Gets the title of the web.
2368
-
2369
- :rtype: str or None
2370
- """
2354
+ # type: () -> Optional[str]
2355
+ """Gets the title of the web."""
2371
2356
  return self.properties.get("Title", None)
2372
2357
 
2373
2358
  @property
2374
2359
  def welcome_page(self):
2375
- """
2376
- Specifies the URL of the Welcome page for the site
2377
-
2378
- :rtype: str or None
2379
- """
2360
+ # type: () -> Optional[str]
2361
+ """Specifies the URL of the Welcome page for the site"""
2380
2362
  return self.properties.get("WelcomePage", None)
2381
2363
 
2382
2364
  @property
@@ -2386,11 +2368,8 @@ class Web(SecurableObject):
2386
2368
 
2387
2369
  @property
2388
2370
  def ui_version(self):
2389
- """
2390
- Gets or sets the user interface (UI) version of the Web site.
2391
-
2392
- :rtype: int or None
2393
- """
2371
+ # type: () -> Optional[int]
2372
+ """Gets or sets the user interface (UI) version of the Web site."""
2394
2373
  return self.properties.get("UIVersion", None)
2395
2374
 
2396
2375
  @property
@@ -2405,13 +2384,12 @@ class Web(SecurableObject):
2405
2384
 
2406
2385
  @property
2407
2386
  def server_relative_path(self):
2408
- """
2409
- Gets the server-relative Path of the Web.
2410
- """
2387
+ """Gets the server-relative Path of the Web."""
2411
2388
  return self.properties.get("ServerRelativePath", SPResPath())
2412
2389
 
2413
2390
  @property
2414
2391
  def syndication_enabled(self):
2392
+ # type: () -> Optional[bool]
2415
2393
  """Specifies whether the [RSS2.0] feeds are enabled on the site"""
2416
2394
  return self.properties.get("SyndicationEnabled", None)
2417
2395
 
@@ -2427,6 +2405,7 @@ class Web(SecurableObject):
2427
2405
 
2428
2406
  @property
2429
2407
  def treeview_enabled(self):
2408
+ # type: () -> Optional[bool]
2430
2409
  """Specifies whether the tree view is enabled on the site"""
2431
2410
  return self.properties.get("TreeViewEnabled", None)
2432
2411
 
@@ -2473,6 +2452,7 @@ class Web(SecurableObject):
2473
2452
  super(Web, self).set_property(name, value, persist_changes)
2474
2453
  if name == "Url":
2475
2454
  self._web_url = value
2455
+ self._resource_path.patch(value)
2476
2456
  return self
2477
2457
 
2478
2458
  @property
@@ -3,7 +3,7 @@ from office365.runtime.queries.create_entity import CreateEntityQuery
3
3
  from office365.subscriptions.subscription import Subscription
4
4
 
5
5
 
6
- class SubscriptionCollection(EntityCollection):
6
+ class SubscriptionCollection(EntityCollection[Subscription]):
7
7
  def __init__(self, context, resource_path=None):
8
8
  super(SubscriptionCollection, self).__init__(
9
9
  context, Subscription, resource_path