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.base_item import BaseItem
2
4
  from office365.onedrive.columns.boolean import BooleanColumn
3
5
  from office365.onedrive.columns.calculated import CalculatedColumn
@@ -30,25 +32,27 @@ class ColumnDefinition(BaseItem):
30
32
  To list hidden field values on listItems, include the desired columns by name in your $select statement.
31
33
  """
32
34
 
35
+ def __str__(self):
36
+ return self.name
37
+
38
+ def __repr__(self):
39
+ return self.name or self.id or self.entity_type_name
40
+
33
41
  @property
34
42
  def display_name(self):
35
- """The user-facing name of the column.
36
-
37
- :rtype: str or None
38
- """
43
+ # type: () -> Optional[str]
44
+ """The user-facing name of the column."""
39
45
  return self.properties.get("displayName", None)
40
46
 
41
47
  @property
42
48
  def enforce_unique_values(self):
43
- """
44
- If true, no two list items may have the same value for this column.
45
-
46
- :rtype: bool or None
47
- """
49
+ # type: () -> Optional[bool]
50
+ """If true, no two list items may have the same value for this column."""
48
51
  return self.properties.get("enforceUniqueValues", None)
49
52
 
50
53
  @property
51
54
  def indexed(self):
55
+ # type: () -> Optional[bool]
52
56
  """Specifies whether the column values can used for sorting and searching."""
53
57
  return self.properties.get("indexed", None)
54
58
 
@@ -61,6 +65,7 @@ class ColumnDefinition(BaseItem):
61
65
 
62
66
  @property
63
67
  def column_group(self):
68
+ # type: () -> Optional[str]
64
69
  """For site columns, the name of the group this column belongs to. Helps organize related columns."""
65
70
  return self.properties.get("columnGroup", None)
66
71
 
@@ -131,45 +136,38 @@ class ColumnDefinition(BaseItem):
131
136
 
132
137
  @property
133
138
  def hidden(self):
134
- """Specifies whether the column is displayed in the user interface.
135
- :rtype: bool or None
136
- """
139
+ # type: () -> Optional[bool]
140
+ """Specifies whether the column is displayed in the user interface."""
137
141
  return self.properties.get("hidden", None)
138
142
 
139
143
  @property
140
144
  def is_deletable(self):
141
- """Indicates whether this column can be deleted.
142
- :rtype: bool or None
143
- """
145
+ # type: () -> Optional[bool]
146
+ """Indicates whether this column can be deleted."""
144
147
  return self.properties.get("isDeletable", None)
145
148
 
146
149
  @property
147
150
  def is_reorderable(self):
148
- """
149
- Indicates whether values in the column can be reordered. Read-only.
150
- :rtype: bool or None
151
- """
151
+ # type: () -> Optional[bool]
152
+ """Indicates whether values in the column can be reordered."""
152
153
  return self.properties.get("isReorderable", None)
153
154
 
154
155
  @property
155
156
  def is_sealed(self):
156
- """Specifies whether the column can be changed.
157
- :rtype: bool or None
158
- """
157
+ # type: () -> Optional[bool]
158
+ """Specifies whether the column can be changed."""
159
159
  return self.properties.get("isSealed", None)
160
160
 
161
161
  @property
162
162
  def propagate_changes(self):
163
- """If 'true', changes to this column will be propagated to lists that implement the column.
164
- :rtype: bool or None
165
- """
163
+ # type: () -> Optional[bool]
164
+ """If 'true', changes to this column will be propagated to lists that implement the column."""
166
165
  return self.properties.get("propagateChanges", None)
167
166
 
168
167
  @property
169
168
  def read_only(self):
170
- """Specifies whether the column values can be modified.
171
- :rtype: bool or None
172
- """
169
+ # type: () -> Optional[bool]
170
+ """Specifies whether the column values can be modified."""
173
171
  return self.properties.get("readOnly", None)
174
172
 
175
173
  @property
@@ -179,6 +177,7 @@ class ColumnDefinition(BaseItem):
179
177
 
180
178
  @property
181
179
  def source_column(self):
180
+ # type: () -> "ColumnDefinition"
182
181
  """The source column for the content type column."""
183
182
  return self.properties.get(
184
183
  "sourceColumn",
@@ -197,10 +196,8 @@ class ColumnDefinition(BaseItem):
197
196
 
198
197
  @property
199
198
  def type(self):
200
- """
201
- For site columns, the type of column.
202
- :rtype: str
203
- """
199
+ # type: () -> Optional[str]
200
+ """For site columns, the type of column."""
204
201
  return self.properties.get("type", None)
205
202
 
206
203
  def get_property(self, name, default_value=None):
@@ -67,7 +67,7 @@ class ColumnDefinitionCollection(EntityCollection[ColumnDefinition]):
67
67
  :param str column_name: The name of the lookup source column.
68
68
  """
69
69
  from office365.onedrive.columns.lookup import LookupColumn
70
- from office365.onedrive.lists.list import List
70
+ from office365.onedrive.lists.list import List # noqa
71
71
 
72
72
  if isinstance(lookup_list, List):
73
73
  return_type = ColumnDefinition(self.context)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.base_item import BaseItem
2
4
  from office365.entity_collection import EntityCollection
3
5
  from office365.onedrive.columns.column_link import ColumnLink
@@ -88,39 +90,33 @@ class ContentType(BaseItem):
88
90
 
89
91
  @property
90
92
  def name(self):
91
- """
92
- The name of the content type.
93
- :rtype: str or None
94
- """
93
+ # type: () -> Optional[str]
94
+ """The name of the content type."""
95
95
  return self.properties.get("name", None)
96
96
 
97
97
  @property
98
98
  def description(self):
99
- """
100
- The descriptive text for the item.
101
- :rtype: str or None
102
- """
99
+ # type: () -> Optional[str]
100
+ """The descriptive text for the item."""
103
101
  return self.properties.get("description", None)
104
102
 
105
103
  @property
106
104
  def parent_id(self):
107
- """The unique identifier of the content type.
108
- :rtype: str or None
109
- """
105
+ # type: () -> Optional[str]
106
+ """The unique identifier of the content type."""
110
107
  return self.properties.get("parentId", None)
111
108
 
112
109
  @property
113
110
  def propagate_changes(self):
114
- """If 'true', changes to this column will be propagated to lists that implement the column.
115
- :rtype: bool or None
116
- """
111
+ # type: () -> Optional[bool]
112
+ """If 'true', changes to this column will be propagated to lists that implement the column."""
117
113
  return self.properties.get("propagateChanges", None)
118
114
 
119
115
  @property
120
116
  def read_only(self):
117
+ # type: () -> Optional[bool]
121
118
  """
122
119
  If true, the content type cannot be modified unless this value is first set to false.
123
- :rtype: bool or None
124
120
  """
125
121
  return self.properties.get("readOnly", None)
126
122
 
@@ -134,6 +130,7 @@ class ContentType(BaseItem):
134
130
 
135
131
  @property
136
132
  def column_links(self):
133
+ # type: () -> EntityCollection[ColumnLink]
137
134
  """The collection of columns that are required by this content type"""
138
135
  return self.properties.get(
139
136
  "columnLinks",
@@ -153,6 +150,7 @@ class ContentType(BaseItem):
153
150
 
154
151
  @property
155
152
  def base_types(self):
153
+ # type: () -> EntityCollection["ContentType"]
156
154
  """The collection of content types that are ancestors of this content type."""
157
155
  return self.properties.get(
158
156
  "baseTypes",
@@ -163,6 +161,7 @@ class ContentType(BaseItem):
163
161
 
164
162
  @property
165
163
  def columns(self):
164
+ # type: () -> EntityCollection[ColumnDefinition]
166
165
  """The collection of column definitions for this contentType."""
167
166
  return self.properties.get(
168
167
  "columns",
@@ -175,6 +174,7 @@ class ContentType(BaseItem):
175
174
 
176
175
  @property
177
176
  def column_positions(self):
177
+ # type: () -> EntityCollection[ColumnDefinition]
178
178
  """Column order information in a content type."""
179
179
  return self.properties.get(
180
180
  "columnPositions",
@@ -187,9 +187,7 @@ class ContentType(BaseItem):
187
187
 
188
188
  @property
189
189
  def order(self):
190
- """
191
- Specifies the order in which the content type appears in the selection UI.
192
- """
190
+ """Specifies the order in which the content type appears in the selection UI."""
193
191
  return self.properties.get("order", ContentTypeOrder())
194
192
 
195
193
  def get_property(self, name, default_value=None):
@@ -1,4 +1,5 @@
1
1
  import datetime
2
+ from typing import Optional
2
3
 
3
4
  from office365.directory.permissions.identity_set import IdentitySet
4
5
  from office365.onedrive.documentsets.version_item import DocumentSetVersionItem
@@ -11,23 +12,25 @@ class DocumentSetVersion(ListItemVersion):
11
12
 
12
13
  @property
13
14
  def comment(self):
15
+ # type: () -> Optional[str]
14
16
  """Comment about the captured version."""
15
17
  return self.properties.get("comment", None)
16
18
 
17
19
  @property
18
20
  def created_by(self):
21
+ # type: () -> IdentitySet
19
22
  """User who captured the version."""
20
23
  return self.properties.get("createdBy", IdentitySet())
21
24
 
22
25
  @property
23
26
  def created_datetime(self):
24
- """
25
- Date and time when this version was created.
26
- """
27
+ # type: () -> datetime.datetime
28
+ """Date and time when this version was created."""
27
29
  return self.properties("createdDateTime", datetime.datetime.min)
28
30
 
29
31
  @property
30
32
  def items(self):
33
+ # type: () -> ClientValueCollection[DocumentSetVersionItem]
31
34
  """Items within the document set that are captured as part of this version."""
32
35
  return self.properties.get(
33
36
  "items", ClientValueCollection(DocumentSetVersionItem)
@@ -35,6 +38,7 @@ class DocumentSetVersion(ListItemVersion):
35
38
 
36
39
  @property
37
40
  def should_capture_minor_version(self):
41
+ # type: () -> Optional[bool]
38
42
  """
39
43
  If true, minor versions of items are also captured; otherwise, only major versions will be captured.
40
44
  Default value is false.
@@ -31,9 +31,6 @@ from office365.onedrive.files.system_info import FileSystemInfo
31
31
  from office365.onedrive.folders.folder import Folder
32
32
  from office365.onedrive.internal.paths.children import ChildrenPath
33
33
  from office365.onedrive.internal.paths.url import UrlPath
34
- from office365.onedrive.internal.queries.resumable_file_upload import (
35
- create_resumable_file_upload_query,
36
- )
37
34
  from office365.onedrive.listitems.item_reference import ItemReference
38
35
  from office365.onedrive.listitems.list_item import ListItem
39
36
  from office365.onedrive.operations.pending import PendingOperations
@@ -50,6 +47,7 @@ from office365.runtime.client_value_collection import ClientValueCollection
50
47
  from office365.runtime.http.http_method import HttpMethod
51
48
  from office365.runtime.http.request_options import RequestOptions
52
49
  from office365.runtime.odata.v4.upload_session import UploadSession
50
+ from office365.runtime.odata.v4.upload_session_request import UploadSessionRequest
53
51
  from office365.runtime.paths.resource_path import ResourcePath
54
52
  from office365.runtime.queries.create_entity import CreateEntityQuery
55
53
  from office365.runtime.queries.function import FunctionQuery
@@ -64,13 +62,30 @@ class DriveItem(BaseItem):
64
62
  """The driveItem resource represents a file, folder, or other item stored in a drive. All file system objects in
65
63
  OneDrive and SharePoint are returned as driveItem resources"""
66
64
 
67
- def get_by_path(self, url_path):
68
- # type: (str) -> "DriveItem"
65
+ def get_files(self, recursive=False):
66
+ """Retrieves files
67
+ :param bool recursive: Determines whether to enumerate folders recursively
69
68
  """
70
- Retrieve DriveItem by server relative path
69
+ return_type = EntityCollection(self.context, DriveItem, self.resource_path)
71
70
 
72
- :type url_path: str
73
- """
71
+ def _get_files(parent_drive_item):
72
+ # type: (DriveItem) -> None
73
+ def _after_loaded():
74
+ for drive_item in parent_drive_item.children:
75
+ if drive_item.is_folder:
76
+ if recursive:
77
+ _get_files(drive_item)
78
+ else:
79
+ return_type.add_child(drive_item)
80
+
81
+ parent_drive_item.ensure_properties(["children"], _after_loaded)
82
+
83
+ _get_files(self)
84
+ return return_type
85
+
86
+ def get_by_path(self, url_path):
87
+ # type: (str) -> "DriveItem"
88
+ """Retrieve DriveItem by server relative path"""
74
89
  return DriveItem(
75
90
  self.context, UrlPath(url_path, self.resource_path), self.children
76
91
  )
@@ -79,7 +94,6 @@ class DriveItem(BaseItem):
79
94
  # type: (str) -> "DriveItem"
80
95
  """
81
96
  Creates a PowerPoint file
82
-
83
97
  :param str name: File name
84
98
  """
85
99
  return self.upload(name, None)
@@ -142,18 +156,14 @@ class DriveItem(BaseItem):
142
156
 
143
157
  def follow(self):
144
158
  # type: () -> Self
145
- """
146
- Follow a driveItem.
147
- """
159
+ """Follow a driveItem."""
148
160
  qry = ServiceOperationQuery(self, "follow")
149
161
  self.context.add_query(qry)
150
162
  return self
151
163
 
152
164
  def unfollow(self):
153
165
  # type: () -> Self
154
- """
155
- Unfollow a driveItem.
156
- """
166
+ """Unfollow a driveItem."""
157
167
  qry = ServiceOperationQuery(self, "unfollow")
158
168
  self.context.add_query(qry)
159
169
  return self
@@ -198,12 +208,21 @@ class DriveItem(BaseItem):
198
208
  :param str source_path: File path
199
209
  :param int chunk_size: chunk size
200
210
  """
211
+
212
+ def _start_upload():
213
+ with open(source_path, "rb") as local_file:
214
+ session_request = UploadSessionRequest(
215
+ local_file, chunk_size, chunk_uploaded
216
+ )
217
+ session_request.execute_query(qry)
218
+
201
219
  file_name = os.path.basename(source_path)
202
220
  return_type = DriveItem(self.context, UrlPath(file_name, self.resource_path))
203
- qry = create_resumable_file_upload_query(
204
- return_type, source_path, chunk_size, chunk_uploaded
221
+
222
+ qry = UploadSessionQuery(
223
+ return_type, {"item": DriveItemUploadableProperties(name=file_name)}
205
224
  )
206
- self.context.add_query(qry)
225
+ self.context.add_query(qry).after_query_execute(_start_upload)
207
226
  return return_type
208
227
 
209
228
  def create_upload_session(self, item):
@@ -233,20 +252,15 @@ class DriveItem(BaseItem):
233
252
  self.children.add_child(qry.return_type)
234
253
 
235
254
  def _modify_query(request):
236
- """
237
- :type request: office365.runtime.http.request_options.RequestOptions
238
- """
255
+ # type: (RequestOptions) -> None
239
256
  request.method = HttpMethod.Put
240
257
 
241
258
  self.context.add_query(qry).before_query_execute(_modify_query)
242
259
  return return_type
243
260
 
244
261
  def upload_file(self, path_or_file):
245
- # type: (str or IO) -> "DriveItem"
246
- """Uploads a file
247
-
248
- :param str or typing.IO path_or_file:
249
- """
262
+ # type: (str|IO) -> "DriveItem"
263
+ """Uploads a file"""
250
264
  if hasattr(path_or_file, "read"):
251
265
  content = path_or_file.read()
252
266
  name = os.path.basename(path_or_file.name)
@@ -278,8 +292,6 @@ class DriveItem(BaseItem):
278
292
  """
279
293
  Download the contents of the primary stream (file) of a DriveItem. Only driveItems with the file property
280
294
  can be downloaded
281
-
282
- :type file_object: typing.IO
283
295
  """
284
296
 
285
297
  def _save_content(return_type):
@@ -305,9 +317,7 @@ class DriveItem(BaseItem):
305
317
  """
306
318
 
307
319
  def _construct_request(request):
308
- """
309
- :type request: office365.runtime.http.request_options.RequestOptions
310
- """
320
+ # type: (RequestOptions) -> None
311
321
  request.stream = True
312
322
 
313
323
  def _process_response(response):
@@ -365,9 +375,7 @@ class DriveItem(BaseItem):
365
375
  return_type = ClientResult(self.context) # type: ClientResult[str]
366
376
 
367
377
  def _create_request(request):
368
- """
369
- :type request: office365.runtime.http.request_options.RequestOptions
370
- """
378
+ # type: (RequestOptions) -> None
371
379
  request.url += "?@microsoft.graph.conflictBehavior={0}".format(
372
380
  conflict_behavior
373
381
  )
@@ -535,14 +543,13 @@ class DriveItem(BaseItem):
535
543
 
536
544
  qry = _create_query()
537
545
  self.context.add_query(qry)
538
-
539
546
  return return_type
540
547
 
541
548
  def permanent_delete(self):
542
549
  """
543
550
  Permanently delete a driveItem.
544
551
  Note that if you delete items using this method, they will be permanently removed and won't be sent to the
545
- recycle bin. Therefore, they cannot be restored afterward.
552
+ recycle bin. Therefore, they cannot be restored afterward. For non-permanent delete, use delete_object()
546
553
  """
547
554
  qry = ServiceOperationQuery(self, "permanentDelete")
548
555
  self.context.add_query(qry)
@@ -584,11 +591,8 @@ class DriveItem(BaseItem):
584
591
  return return_type
585
592
 
586
593
  def validate_permission(self, challenge_token=None, password=None):
587
- # type: (str or None, str or None) -> Self
588
- """
589
- :type challenge_token: str
590
- :type password: str
591
- """
594
+ # type: (Optional[str], Optional[str]) -> Self
595
+ """ """
592
596
  payload = {"challengeToken": challenge_token, "password": password}
593
597
  qry = ServiceOperationQuery(self, "validatePermission", None, payload)
594
598
  self.context.add_query(qry)
@@ -621,9 +625,7 @@ class DriveItem(BaseItem):
621
625
  @property
622
626
  def location(self):
623
627
  # type: () -> GeoCoordinates
624
- """
625
- Location metadata, if the item has location data. Read-only.
626
- """
628
+ """Location metadata, if the item has location data"""
627
629
  return self.properties.get("location", GeoCoordinates())
628
630
 
629
631
  @property
@@ -666,15 +668,12 @@ class DriveItem(BaseItem):
666
668
  @property
667
669
  def web_dav_url(self):
668
670
  # type: () -> str or None
669
- """
670
- WebDAV compatible URL for the item.
671
- :rtype: str or None
672
- """
671
+ """WebDAV compatible URL for the item."""
673
672
  return self.properties.get("webDavUrl", None)
674
673
 
675
674
  @property
676
675
  def children(self):
677
- # type: () -> EntityCollection[DriveItem]
676
+ # type: () -> EntityCollection["DriveItem"]
678
677
  """Collection containing Item objects for the immediate children of Item. Only items representing folders
679
678
  have children.
680
679
  """
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.base_item import BaseItem
2
4
  from office365.directory.permissions.identity_set import IdentitySet
3
5
  from office365.entity_collection import EntityCollection
@@ -73,11 +75,10 @@ class Drive(BaseItem):
73
75
 
74
76
  @property
75
77
  def drive_type(self):
78
+ # type: () -> Optional[str]
76
79
  """
77
80
  Describes the type of drive represented by this resource. OneDrive personal drives will return personal.
78
81
  OneDrive for Business will return business. SharePoint document libraries will return documentLibrary.
79
-
80
- :rtype: str or None
81
82
  """
82
83
  return self.properties.get("driveType", None)
83
84
 
@@ -117,6 +118,7 @@ class Drive(BaseItem):
117
118
 
118
119
  @property
119
120
  def bundles(self):
121
+ # type: () -> EntityCollection[DriveItem]
120
122
  """Bundle metadata, if the item is a bundle."""
121
123
  return self.properties.get(
122
124
  "bundles",
@@ -127,6 +129,7 @@ class Drive(BaseItem):
127
129
 
128
130
  @property
129
131
  def items(self):
132
+ # type: () -> EntityCollection[DriveItem]
130
133
  """All items contained in the drive."""
131
134
  return self.properties.get(
132
135
  "items",
@@ -137,6 +140,7 @@ class Drive(BaseItem):
137
140
 
138
141
  @property
139
142
  def following(self):
143
+ # type: () -> EntityCollection[DriveItem]
140
144
  """The list of items the user is following. Only in OneDrive for Business."""
141
145
  return self.properties.get(
142
146
  "following",
@@ -152,6 +156,7 @@ class Drive(BaseItem):
152
156
 
153
157
  @property
154
158
  def special(self):
159
+ # type: () -> EntityCollection[DriveItem]
155
160
  """Collection of auth folders available in OneDrive. Read-only. Nullable."""
156
161
  return self.properties.get(
157
162
  "special",
@@ -1,4 +1,4 @@
1
- from office365.runtime.paths.entity import EntityPath
1
+ from office365.runtime.paths.v4.entity import EntityPath
2
2
 
3
3
 
4
4
  class ChildrenPath(EntityPath):
@@ -13,5 +13,5 @@ class ChildrenPath(EntityPath):
13
13
  if isinstance(self.parent, EntityPath):
14
14
  self._collection = self.parent.collection
15
15
  else:
16
- self._collection = self.parent.parent
16
+ self._collection = self.parent
17
17
  return self._collection
@@ -1,4 +1,4 @@
1
- from office365.runtime.paths.entity import EntityPath
1
+ from office365.runtime.paths.v4.entity import EntityPath
2
2
 
3
3
 
4
4
  class RootPath(EntityPath):
@@ -19,4 +19,4 @@ class SharedPath(ResourcePath):
19
19
 
20
20
  @property
21
21
  def segment(self):
22
- return _url_to_shared_token(self.key)
22
+ return _url_to_shared_token(self._key)
@@ -1,6 +1,6 @@
1
1
  from office365.runtime.compat import is_absolute_url, urlparse
2
- from office365.runtime.paths.entity import EntityPath
3
2
  from office365.runtime.paths.resource_path import ResourcePath
3
+ from office365.runtime.paths.v4.entity import EntityPath
4
4
 
5
5
 
6
6
  class SitePath(EntityPath):
@@ -8,8 +8,8 @@ class SitePath(EntityPath):
8
8
 
9
9
  @property
10
10
  def segment(self):
11
- if is_absolute_url(self.key):
12
- url_result = urlparse(self.key)
11
+ if is_absolute_url(self._key):
12
+ url_result = urlparse(self._key)
13
13
  return ":".join([url_result.hostname, url_result.path])
14
14
  else:
15
15
  return super(SitePath, self).segment
@@ -1,5 +1,5 @@
1
1
  from office365.onedrive.internal.paths.root import RootPath
2
- from office365.runtime.paths.entity import EntityPath
2
+ from office365.runtime.paths.v4.entity import EntityPath
3
3
 
4
4
 
5
5
  class UrlPath(EntityPath):
@@ -11,7 +11,7 @@ class UrlPath(EntityPath):
11
11
  :type parent: office365.runtime.paths.resource_path.ResourcePath
12
12
  """
13
13
  if isinstance(parent, UrlPath):
14
- url = "/".join([parent.key, url])
14
+ url = "/".join([parent._key, url])
15
15
  collection = parent.collection
16
16
  parent = parent.parent
17
17
  elif isinstance(parent, RootPath):
@@ -60,6 +60,7 @@ class ListItem(BaseItem):
60
60
 
61
61
  @property
62
62
  def content_type(self):
63
+ # type: () -> ContentTypeInfo
63
64
  """The content type of this list item"""
64
65
  return self.properties.get("contentType", ContentTypeInfo())
65
66
 
@@ -73,6 +74,7 @@ class ListItem(BaseItem):
73
74
 
74
75
  @property
75
76
  def document_set_versions(self):
77
+ # type: () -> EntityCollection[DocumentSetVersion]
76
78
  """Version information for a document set version created by a user."""
77
79
  return self.properties.get(
78
80
  "documentSetVersions",
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.base_item import BaseItem
2
4
  from office365.entity_collection import EntityCollection
3
5
  from office365.onedrive.columns.definition_collection import ColumnDefinitionCollection
@@ -14,12 +16,13 @@ class List(BaseItem):
14
16
  """The list resource represents a list in a site. This resource contains the top level properties of the list,
15
17
  including template and field definitions."""
16
18
 
19
+ def __str__(self):
20
+ return self.display_name
21
+
17
22
  @property
18
23
  def display_name(self):
19
- """
20
- The displayable title of the list
21
- :rtype: str or None
22
- """
24
+ # type: () -> Optional[str]
25
+ """The displayable title of the list"""
23
26
  return self.properties.get("displayName", None)
24
27
 
25
28
  @property