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
@@ -4,78 +4,78 @@ class ChangeType:
4
4
  def __init__(self):
5
5
  pass
6
6
 
7
- NoChange = "NoChange"
7
+ NoChange = 0
8
8
  """Indicates that no change has taken place."""
9
9
 
10
- Add = "Add"
10
+ Add = 1
11
11
  """Specifies that an object has been added within the scope of a list, site, site collection, or content database"""
12
12
 
13
- Update = "Update"
13
+ Update = 2
14
14
  """Specifies that an object has been modified within the scope of a list, site, site collection,
15
15
  or content database."""
16
16
 
17
- DeleteObject = "DeleteObject"
17
+ DeleteObject = 3
18
18
  """
19
19
  Specifies that an object has been deleted within the scope of a list, site, site collection, or content database
20
20
  """
21
21
 
22
- Rename = "Rename"
22
+ Rename = 4
23
23
  """The leaf in a URL has been renamed."""
24
24
 
25
- MoveAway = "MoveAway"
25
+ MoveAway = 5
26
26
  """Specifies that a non-leaf segment within a URL has been renamed. The object was moved away from the
27
27
  location within the site specified by the change."""
28
28
 
29
- MoveInto = "MoveInto"
29
+ MoveInto = 6
30
30
  """Specifies that a non-leaf segment within a URL has been renamed. The object was moved into the location within
31
31
  the site specified by the change."""
32
32
 
33
- Restore = "Restore"
33
+ Restore = 7
34
34
  """Specifies that an object (1) has restored from a backup or from the Recycle Bin"""
35
35
 
36
- RoleAdd = "RoleAdd"
36
+ RoleAdd = 8
37
37
  """Specifies that a role definition has been added."""
38
38
 
39
- RoleDelete = "RoleDelete"
39
+ RoleDelete = 9
40
40
  """Specifies that a role definition has been deleted."""
41
41
 
42
- RoleUpdate = "RoleUpdate"
42
+ RoleUpdate = 10
43
43
  """Specifies that a role definition has been updated."""
44
44
 
45
- AssignmentAdd = "AssignmentAdd"
45
+ AssignmentAdd = 11
46
46
  """Specifies that a user has been given permissions to a list. The list MUST have different permissions from
47
47
  its parent."""
48
48
 
49
- AssignmentDelete = "AssignmentDelete"
49
+ AssignmentDelete = 12
50
50
  """Specifies that a user has lost permissions to a list. The list MUST have different permissions from its parent"""
51
51
 
52
- MemberAdd = "MemberAdd"
52
+ MemberAdd = 13
53
53
  """Specifies that a user has been added to a group."""
54
54
 
55
- MemberDelete = "MemberDelete"
55
+ MemberDelete = 14
56
56
  """Specifies that a user has been removed from a group."""
57
57
 
58
- SystemUpdate = "SystemUpdate"
58
+ SystemUpdate = 15
59
59
  """Specifies that a change has been made to an item by using the protocol server method."""
60
60
 
61
- Navigation = "Navigation"
61
+ Navigation = 16
62
62
  """Specifies that a change in the navigation structure of a site collection has been made."""
63
63
 
64
- ScopeAdd = "ScopeAdd"
64
+ ScopeAdd = 17
65
65
  """Specifies that a change in permissions scope has been made to break inheritance from the parent of an object """
66
66
 
67
- ScopeDelete = "ScopeDelete"
67
+ ScopeDelete = 18
68
68
  """Specifies that a change in permissions scope has been made to revert back to inheriting permissions from
69
69
  the parent of an object"""
70
70
 
71
- ListContentTypeAdd = "ListContentTypeAdd"
71
+ ListContentTypeAdd = 19
72
72
  """Specifies that a list content type has been added."""
73
73
 
74
- ListContentTypeDelete = "ListContentTypeDelete"
74
+ ListContentTypeDelete = 20
75
75
  """Specifies that a list content type has been deleted."""
76
76
 
77
- Dirty = "Dirty"
77
+ Dirty = 21
78
78
  """Specifies that this item has a pending modification due to an operation on another item."""
79
79
 
80
- Activity = "Activity"
80
+ Activity = 22
81
81
  """Specifies that an activity change as specified in section 3.2.5.462 has been made to the object """
@@ -1,14 +1,18 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.changes.change import Change
2
4
 
3
5
 
4
6
  class ChangeWeb(Change):
5
7
  """Specifies a change on a site"""
6
8
 
9
+ def __repr__(self):
10
+ return "Web: {0}, Action: {1}".format(self.web_id, self.change_type_name)
11
+
7
12
  @property
8
13
  def web_id(self):
14
+ # type: () -> Optional[str]
9
15
  """
10
- Identifies the site (2) that has changed
11
-
12
- :rtype: str or None
16
+ Identifies the site that has changed
13
17
  """
14
18
  return self.properties.get("WebId", None)
@@ -8,6 +8,7 @@ from office365.runtime.auth.authentication_context import AuthenticationContext
8
8
  from office365.runtime.auth.client_credential import ClientCredential
9
9
  from office365.runtime.auth.token_response import TokenResponse
10
10
  from office365.runtime.auth.user_credential import UserCredential
11
+ from office365.runtime.client_result import ClientResult
11
12
  from office365.runtime.client_runtime_context import ClientRuntimeContext
12
13
  from office365.runtime.compat import get_absolute_url, urlparse
13
14
  from office365.runtime.http.http_method import HttpMethod
@@ -19,8 +20,14 @@ from office365.runtime.paths.resource_path import ResourcePath
19
20
  from office365.runtime.queries.delete_entity import DeleteEntityQuery
20
21
  from office365.runtime.queries.update_entity import UpdateEntityQuery
21
22
  from office365.runtime.types.event_handler import EventHandler
23
+ from office365.sharepoint.portal.groups.site_info import GroupSiteInfo
24
+ from office365.sharepoint.portal.sites.creation_response import SPSiteCreationResponse
22
25
  from office365.sharepoint.portal.sites.status import SiteStatus
26
+ from office365.sharepoint.principal.users.user import User
23
27
  from office365.sharepoint.publishing.pages.service import SitePageService
28
+ from office365.sharepoint.publishing.sites.communication.creation_response import (
29
+ CommunicationSiteCreationResponse,
30
+ )
24
31
  from office365.sharepoint.request_user_context import RequestUserContext
25
32
  from office365.sharepoint.sites.site import Site
26
33
  from office365.sharepoint.tenant.administration.hubsites.collection import (
@@ -279,8 +286,10 @@ class ClientContext(ClientRuntimeContext):
279
286
  request.ensure_header("IF-MATCH", "*")
280
287
 
281
288
  def create_modern_site(self, title, alias, owner=None):
289
+ # type: (str, str, Optional[str | User]) -> Site
282
290
  """
283
- Creates a modern site
291
+ Creates a modern (Communication) site
292
+ https://learn.microsoft.com/en-us/sharepoint/dev/apis/site-creation-rest#create-a-modern-site
284
293
 
285
294
  :param str alias: Site alias which defines site url, e.g. https://contoso.sharepoint.com/sites/{alias}
286
295
  :param str title: Site title
@@ -290,19 +299,17 @@ class ClientContext(ClientRuntimeContext):
290
299
  site_url = "{base_url}/sites/{alias}".format(
291
300
  base_url=get_absolute_url(self.base_url), alias=alias
292
301
  )
293
- result = self.site_manager.create(title, site_url, owner)
294
302
 
295
- def _after_site_create(resp):
296
- """
297
- :type resp: requests.Response
298
- """
299
- resp.raise_for_status()
303
+ def _after_site_create(result):
304
+ # type: (ClientResult[SPSiteCreationResponse]) -> None
300
305
  if result.value.SiteStatus == SiteStatus.Error:
301
306
  raise ValueError(result.value.ErrorMessage)
302
307
  elif result.value.SiteStatus == SiteStatus.Ready:
303
308
  return_type.set_property("__siteUrl", result.value.SiteUrl)
304
309
 
305
- self.after_execute(_after_site_create)
310
+ self.site_manager.create(title, site_url, owner).after_execute(
311
+ _after_site_create
312
+ )
306
313
  return return_type
307
314
 
308
315
  def create_team_site(self, alias, title, is_public=True):
@@ -312,20 +319,18 @@ class ClientContext(ClientRuntimeContext):
312
319
  :param str title: Site title
313
320
  :param bool is_public:
314
321
  """
315
- result = self.group_site_manager.create_group_ex(title, alias, is_public)
316
322
  return_type = Site(self)
317
323
 
318
- def _after_site_created(resp):
319
- """
320
- :type resp: requests.Response
321
- """
322
- resp.raise_for_status()
324
+ def _after_site_created(result):
325
+ # type: (ClientResult[GroupSiteInfo]) -> None
323
326
  if result.value.SiteStatus == SiteStatus.Error:
324
327
  raise ValueError(result.value.ErrorMessage)
325
328
  elif result.value.SiteStatus == SiteStatus.Ready:
326
329
  return_type.set_property("__siteUrl", result.value.SiteUrl)
327
330
 
328
- self.after_execute(_after_site_created)
331
+ self.group_site_manager.create_group_ex(title, alias, is_public).after_execute(
332
+ _after_site_created
333
+ )
329
334
  return return_type
330
335
 
331
336
  def create_communication_site(self, alias, title):
@@ -341,9 +346,7 @@ class ClientContext(ClientRuntimeContext):
341
346
  )
342
347
 
343
348
  def _after_site_created(result):
344
- """
345
- :type result: ClientResult
346
- """
349
+ # type: (ClientResult[CommunicationSiteCreationResponse]) -> None
347
350
  if result.value.SiteStatus == SiteStatus.Error:
348
351
  raise ValueError("Site creation error")
349
352
  elif result.value.SiteStatus == SiteStatus.Ready:
@@ -4,14 +4,14 @@ from office365.sharepoint.entity import Entity
4
4
 
5
5
 
6
6
  class HostedAppsManager(Entity):
7
- def get_by_id(self, _id):
7
+ def get_by_id(self, id_):
8
8
  """
9
9
  Gets an hosted app based on the Id.
10
10
 
11
- :param str _id: The Id of the hosted app to get.
11
+ :param str id_: The Id of the hosted app to get.
12
12
  """
13
13
  return HostedApp(
14
- self.context, ServiceOperationPath("GetById", [_id], self.resource_path)
14
+ self.context, ServiceOperationPath("GetById", [id_], self.resource_path)
15
15
  )
16
16
 
17
17
  @property
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.paths.resource_path import ResourcePath
2
4
  from office365.runtime.queries.service_operation import ServiceOperationQuery
3
5
  from office365.runtime.types.collections import StringCollection
@@ -17,6 +19,12 @@ class ContentType(Entity):
17
19
  to items of those types
18
20
  """
19
21
 
22
+ def __str__(self):
23
+ return self.name
24
+
25
+ def __repr__(self):
26
+ return self.string_id or str(self.id) or self.entity_type_name
27
+
20
28
  def reorder_fields(self, field_names):
21
29
  """
22
30
  The ReorderFields method is called to change the order in which fields appear in a content type.
@@ -43,58 +51,56 @@ class ContentType(Entity):
43
51
 
44
52
  @property
45
53
  def client_form_custom_formatter(self):
46
- """
47
- :rtype: str
48
- """
54
+ # type: () -> Optional[str]
49
55
  return self.properties.get("ClientFormCustomFormatter", None)
50
56
 
51
57
  @property
52
58
  def display_form_client_side_component_id(self):
59
+ # type: () -> Optional[str]
53
60
  """
54
61
  The component ID of an SPFx Form Customizer to connect to this content type for usage with display forms.
55
- :rtype: str
56
62
  """
57
63
  return self.properties.get("DisplayFormClientSideComponentId", None)
58
64
 
59
65
  @property
60
66
  def display_form_client_side_component_properties(self):
67
+ # type: () -> Optional[str]
61
68
  """
62
69
  The component properties of an SPFx Form Customizer to connect to this content type for usage with display forms
63
- :rtype: str
64
70
  """
65
71
  return self.properties.get("DisplayFormClientSideComponentProperties", None)
66
72
 
67
73
  @property
68
74
  def display_form_template_name(self):
75
+ # type: () -> Optional[str]
69
76
  """
70
77
  Specifies the name of a custom display form template to use for list items that have been assigned
71
78
  the content type.
72
- :rtype: str or None
73
79
  """
74
80
  return self.properties.get("DisplayFormTemplateName", None)
75
81
 
76
82
  @property
77
83
  def display_form_url(self):
84
+ # type: () -> Optional[str]
78
85
  """
79
86
  Specifies the URL of a custom display form to use for list items that have been assigned the content type.
80
- :rtype: str or None
81
87
  """
82
88
  return self.properties.get("DisplayFormUrl", None)
83
89
 
84
90
  @property
85
91
  def edit_form_client_side_component_id(self):
92
+ # type: () -> Optional[str]
86
93
  """
87
94
  The component properties of an SPFx Form Customizer to connect to this content type for usage with edit item
88
95
  forms
89
- :rtype: str or None
90
96
  """
91
97
  return self.properties.get("EditFormClientSideComponentId", None)
92
98
 
93
99
  @property
94
100
  def edit_form_client_side_component_properties(self):
101
+ # type: () -> Optional[str]
95
102
  """
96
103
  The component ID of an SPFx Form Customizer to connect to this content type for usage with edit item forms
97
- :rtype: str
98
104
  """
99
105
  return self.properties.get("EditFormClientSideComponentProperties", None)
100
106
 
@@ -107,53 +113,45 @@ class ContentType(Entity):
107
113
 
108
114
  @property
109
115
  def sealed(self):
110
- """Specifies whether the content type can be changed.
111
- :rtype: bool or None
112
- """
116
+ # type: () -> Optional[bool]
117
+ """Specifies whether the content type can be changed."""
113
118
  return self.properties.get("Sealed", None)
114
119
 
115
120
  @property
116
121
  def string_id(self):
117
- """A string representation of the value of the Id
118
- :rtype: str
119
- """
122
+ # type: () -> Optional[str]
123
+ """A string representation of the value of the Id"""
120
124
  return self.properties.get("StringId", None)
121
125
 
122
126
  @property
123
127
  def name(self):
124
- """Gets the name of the content type.
125
- :rtype: str or None
126
- """
128
+ # type: () -> Optional[str]
129
+ """Gets the name of the content type."""
127
130
  return self.properties.get("Name", None)
128
131
 
129
132
  @name.setter
130
133
  def name(self, value):
131
- """Sets the name of the content type.
132
- :rtype: str or None
133
- """
134
+ # type: (str) -> None
135
+ """Sets the name of the content type."""
134
136
  self.set_property("Name", value)
135
137
 
136
138
  @property
137
139
  def new_form_client_side_component_properties(self):
138
- """
139
- The component properties of an SPFx Form Customizer to connect to this content type for usage with new item forms
140
- :rtype: str or None
141
- """
140
+ # type: () -> Optional[str]
141
+ """The component properties of an SPFx Form Customizer to connect to this content type for usage with new
142
+ item forms"""
142
143
  return self.properties.get("NewFormClientSideComponentProperties", None)
143
144
 
144
145
  @property
145
146
  def description(self):
146
- """Gets the description of the content type.
147
- :rtype: str or None
148
- """
147
+ # type: () -> Optional[str]
148
+ """Gets the description of the content type."""
149
149
  return self.properties.get("Description", None)
150
150
 
151
151
  @description.setter
152
152
  def description(self, value):
153
- """Sets the description of the content type.
154
-
155
- :type value: str
156
- """
153
+ # type: (str) -> None
154
+ """Sets the description of the content type."""
157
155
  self.set_property("Description", value)
158
156
 
159
157
  @property
@@ -168,60 +166,54 @@ class ContentType(Entity):
168
166
 
169
167
  @property
170
168
  def document_template(self):
171
- """
172
- Specifies the file path to the document template (1) used for a new list item that has been assigned
173
- the content type.
174
- :rtype: str or None
169
+ # type: () -> Optional[str]
170
+ """Specifies the file path to the document template (1) used for a new list item that has been assigned
171
+ the content type.
175
172
  """
176
173
  return self.properties.get("DocumentTemplate", None)
177
174
 
178
175
  @property
179
176
  def document_template_url(self):
180
- """
181
- Specifies the URL of the document template assigned to the content type.
182
- :rtype: str or None
183
- """
177
+ # type: () -> Optional[str]
178
+ """Specifies the URL of the document template assigned to the content type."""
184
179
  return self.properties.get("DocumentTemplateUrl", None)
185
180
 
186
181
  @property
187
182
  def edit_form_url(self):
183
+ # type: () -> Optional[str]
188
184
  """
189
185
  Specifies the URL of a custom edit form to use for list items that have been assigned the content type.
190
- :rtype: str or None
191
186
  """
192
187
  return self.properties.get("EditFormUrl", None)
193
188
 
194
189
  @property
195
190
  def group(self):
196
- """Gets the group of the content type.
197
- :rtype: str or None
198
- """
191
+ # type: () -> Optional[str]
192
+ """Gets the group of the content type."""
199
193
  return self.properties.get("Group", None)
200
194
 
201
195
  @group.setter
202
196
  def group(self, value):
203
- """Sets the group of the content type.
204
- :type value: str or None
205
- """
197
+ # type: (str) -> None
198
+ """Sets the group of the content type."""
206
199
  self.set_property("Group", value)
207
200
 
208
201
  @property
209
202
  def hidden(self):
203
+ # type: () -> Optional[bool]
210
204
  """Specifies whether the content type is unavailable for creation or usage directly from a user interface."""
211
205
  return self.properties.get("Hidden", None)
212
206
 
213
207
  @property
214
208
  def js_link(self):
215
- """Gets or sets the JSLink for the content type custom form template
216
- :rtype: str or None
217
- """
209
+ # type: () -> Optional[str]
210
+ """Gets or sets the JSLink for the content type custom form template"""
218
211
  return self.properties.get("JSLink", None)
219
212
 
220
213
  @property
221
214
  def read_only(self):
222
- """Specifies whether changes to the content type properties are denied.
223
- :rtype: bool or None
224
- """
215
+ # type: () -> Optional[bool]
216
+ """Specifies whether changes to the content type properties are denied."""
225
217
  return self.properties.get("ReadOnly", None)
226
218
 
227
219
  @property
@@ -236,9 +228,8 @@ class ContentType(Entity):
236
228
 
237
229
  @property
238
230
  def schema_xml(self):
239
- """Specifies the XML schema that represents the content type.
240
- :rtype: str or None
241
- """
231
+ # type: () -> Optional[str]
232
+ """Specifies the XML schema that represents the content type."""
242
233
  return self.properties.get("SchemaXml", None)
243
234
 
244
235
  @property
@@ -20,4 +20,4 @@ class ContentTypeId(ClientValue):
20
20
  self.StringValue = string_value
21
21
 
22
22
  def __repr__(self):
23
- return self.StringValue
23
+ return self.StringValue or self.entity_type_name
@@ -36,8 +36,8 @@ class DocumentId(Entity):
36
36
  Performs the same function as ResetDocIdByServerRelativePath (section 3.1.5.10.2.1.1), but for every
37
37
  document in the specified document library.
38
38
 
39
- :param str decoded_url: Server relative path to the document library, for which all document identifiers MUST be reset to guarantee
40
- global uniqueness in the farm.
39
+ :param str decoded_url: Server relative path to the document library, for which all document identifiers
40
+ MUST be reset to guarantee global uniqueness in the farm.
41
41
  :param str content_type_id: The content type identifier.
42
42
  """
43
43
  payload = {"DecodedUrl": decoded_url, "contentTypeId": content_type_id}
@@ -1,6 +1,8 @@
1
1
  from office365.runtime.http.http_method import HttpMethod
2
+ from office365.runtime.http.request_options import RequestOptions
2
3
  from office365.runtime.queries.client_query import ClientQuery
3
4
  from office365.sharepoint.folders.folder import Folder
5
+ from office365.sharepoint.lists.list import List
4
6
 
5
7
 
6
8
  class DocumentSet(Folder):
@@ -10,7 +12,8 @@ class DocumentSet(Folder):
10
12
  Creates a DocumentSet (section 3.1.5.3) object on the server.
11
13
 
12
14
  :type context: office365.sharepoint.client_context.ClientContext
13
- :param office365.sharepoint.folders.folder.Folder parent_folder: The folder inside which to create the new DocumentSet.
15
+ :param office365.sharepoint.folders.folder.Folder parent_folder: The folder inside which to create the new
16
+ DocumentSet.
14
17
  :param str name: The name to give to the new DocumentSet
15
18
  :param office365.sharepoint.contenttypes.content_type_id.ContentTypeId ct_id: The identifier of the content
16
19
  type to give to the new document set.
@@ -25,18 +28,14 @@ class DocumentSet(Folder):
25
28
  target_list.ensure_property("Title", _create, target_list=target_list)
26
29
 
27
30
  def _create(target_list):
28
- """
29
- :type target_list: office365.sharepoint.lists.list.List
30
- """
31
+ # type: (List) -> None
31
32
  qry = ClientQuery(context, return_type=return_type)
32
33
  context.add_query(qry)
33
34
  folder_url = parent_folder.serverRelativeUrl + "/" + name
34
35
  return_type.set_property("ServerRelativeUrl", folder_url)
35
36
 
36
37
  def _construct_request(request):
37
- """
38
- :type request: office365.runtime.http.request_options.RequestOptions
39
- """
38
+ # type: (RequestOptions) -> None
40
39
  list_name = target_list.title.replace(" ", "")
41
40
  request.url = r"{0}/_vti_bin/listdata.svc/{1}".format(
42
41
  context.base_url, list_name
@@ -2,6 +2,7 @@ from typing import TYPE_CHECKING, Optional, Type, TypeVar
2
2
 
3
3
  from office365.runtime.client_object_collection import ClientObjectCollection
4
4
  from office365.runtime.paths.resource_path import ResourcePath
5
+ from office365.runtime.paths.v3.entity import EntityPath
5
6
  from office365.sharepoint.entity import Entity
6
7
 
7
8
  if TYPE_CHECKING:
@@ -21,6 +22,14 @@ class EntityCollection(ClientObjectCollection[T]):
21
22
  context, item_type, resource_path, parent
22
23
  )
23
24
 
25
+ def create_typed_object(self, initial_properties=None, resource_path=None):
26
+ # type: (Optional[dict], Optional[ResourcePath]) -> T
27
+ if resource_path is None:
28
+ resource_path = EntityPath(None, self.resource_path)
29
+ return super(EntityCollection, self).create_typed_object(
30
+ initial_properties, resource_path
31
+ )
32
+
24
33
  @property
25
34
  def context(self):
26
35
  # type: () -> ClientContext
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.entity import Entity
2
4
 
3
5
 
@@ -6,16 +8,12 @@ class Feature(Entity):
6
8
 
7
9
  @property
8
10
  def definition_id(self):
9
- """
10
- Gets the GUID that identifies this feature.
11
- :rtype: str or None
12
- """
11
+ # type: () -> Optional[str]
12
+ """Gets the GUID that identifies this feature."""
13
13
  return self.properties.get("DefinitionId", None)
14
14
 
15
15
  @property
16
16
  def display_name(self):
17
- """
18
- Gets the GUID that identifies this feature.
19
- :rtype: str or None
20
- """
17
+ # type: () -> Optional[str]
18
+ """Gets the GUID that identifies this feature."""
21
19
  return self.properties.get("DisplayName", None)
@@ -104,10 +104,10 @@ class FieldCollection(EntityCollection[Field]):
104
104
  """
105
105
  if allow_multiple_values:
106
106
  field_schema = """
107
- <Field Type="LookupMulti" Mult="TRUE" DisplayName="{title}" Required="FALSE" Hidden="TRUE" \
108
- ShowField="{lookup_field_name}" List="{{{lookup_list_id}}}" StaticName="{title}" Name="{title}">
109
- </Field>
110
- """.format(
107
+ <Field Type="LookupMulti" Mult="TRUE" DisplayName="{title}" Required="FALSE" Hidden="TRUE" \
108
+ ShowField="{lookup_field_name}" List="{{{lookup_list_id}}}" StaticName="{title}" Name="{title}">
109
+ </Field>
110
+ """.format(
111
111
  title=title,
112
112
  lookup_field_name=lookup_field_name,
113
113
  lookup_list_id=lookup_list_id,
@@ -172,7 +172,8 @@ class FieldCollection(EntityCollection[Field]):
172
172
  """Adds a secondary lookup field to a field collection (target).
173
173
  Args:
174
174
  display_name (str): title of the added field in the target FieldCollection.
175
- primary_lookup_field_id (str): ID of the main lookup-field in the target to associate the dependent lookup field with.
175
+ primary_lookup_field_id (str): ID of the main lookup-field in the target to
176
+ associate the dependent lookup field with.
176
177
  show_field (str): name of the field from the source list to include data from.
177
178
  Returns:
178
179
  Field: reference to the SP.Field that was added.