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,4 +1,5 @@
1
1
  import datetime
2
+ from typing import Optional
2
3
 
3
4
  from office365.entity import Entity
4
5
  from office365.runtime.queries.service_operation import ServiceOperationQuery
@@ -15,14 +16,15 @@ class Subscription(Entity):
15
16
 
16
17
  @property
17
18
  def application_id(self):
19
+ # type: () -> Optional[str]
18
20
  """
19
21
  Identifier of the application used to create the subscription.
20
- :rtype: str or None
21
22
  """
22
23
  return self.properties.get("applicationId", None)
23
24
 
24
25
  @property
25
26
  def change_type(self):
27
+ # type: () -> Optional[str]
26
28
  """
27
29
  Required. Indicates the type of change in the subscribed resource that will raise a change notification.
28
30
  The supported values are: created, updated, deleted.
@@ -33,51 +35,51 @@ class Subscription(Entity):
33
35
  User and group change notifications support updated and deleted changeType. Use updated to receive
34
36
  notifications when user or group is created, updated or soft deleted. Use deleted to receive notifications
35
37
  when user or group is permanently deleted.
36
- :rtype: str or None
37
38
  """
38
39
  return self.properties.get("changeType", None)
39
40
 
40
41
  @property
41
42
  def client_state(self):
43
+ # type: () -> Optional[str]
42
44
  """
43
45
  Required. Specifies the value of the clientState property sent by the service in each change notification.
44
46
  The maximum length is 128 characters. The client can check that the change notification came from the service
45
47
  by comparing the value of the clientState property sent with the subscription with the value of the clientState
46
48
  property received with each change notification.
47
- :rtype: str or None
48
49
  """
49
50
  return self.properties.get("clientState", None)
50
51
 
51
52
  @property
52
53
  def creator_id(self):
54
+ # type: () -> Optional[str]
53
55
  """
54
56
  Optional. Identifier of the user or service principal that created the subscription. If the app used
55
57
  delegated permissions to create the subscription, this field contains the id of the signed-in user the app
56
58
  called on behalf of. If the app used application permissions, this field contains the id of the service
57
59
  principal corresponding to the app. Read-only.
58
- :rtype: str or None
59
60
  """
60
61
  return self.properties.get("creatorId", None)
61
62
 
62
63
  @property
63
64
  def encryption_certificate(self):
65
+ # type: () -> Optional[str]
64
66
  """
65
67
  Optional. A base64-encoded representation of a certificate with a public key used to encrypt resource data in
66
68
  change notifications. Optional but required when includeResourceData is true.
67
- :rtype: str or None
68
69
  """
69
70
  return self.properties.get("encryptionCertificate", None)
70
71
 
71
72
  @property
72
73
  def encryption_certificate_id(self):
74
+ # type: () -> Optional[str]
73
75
  """
74
76
  Optional. A custom app-provided identifier to help identify the certificate needed to decrypt resource data.
75
- :rtype: str or None
76
77
  """
77
78
  return self.properties.get("encryptionCertificateId", None)
78
79
 
79
80
  @property
80
81
  def expiration_datetime(self):
82
+ # type: () -> Optional[datetime.datetime]
81
83
  """
82
84
  Required. Specifies the date and time when the webhook subscription expires. The time is in UTC, and can be
83
85
  an amount of time from subscription creation that varies for the resource subscribed to
@@ -86,14 +88,15 @@ class Subscription(Entity):
86
88
 
87
89
  @property
88
90
  def include_resource_data(self):
91
+ # type: () -> Optional[bool]
89
92
  """
90
93
  Optional. When set to true, change notifications include resource data (such as content of a chat message).
91
- :rtype: bool
92
94
  """
93
95
  return self.properties.get("includeResourceData", None)
94
96
 
95
97
  @property
96
98
  def latest_supported_tls_version(self):
99
+ # type: () -> Optional[str]
97
100
  """
98
101
  Optional. Specifies the latest version of Transport Layer Security (TLS) that the notification endpoint,
99
102
  specified by notificationUrl, supports. The possible values are: v1_0, v1_1, v1_2, v1_3.
@@ -105,38 +108,37 @@ class Subscription(Entity):
105
108
 
106
109
  For subscribers whose notification endpoint already supports TLS 1.2, setting this property is optional.
107
110
  In such cases, Microsoft Graph defaults the property to v1_2.
108
- :rtype: str
109
111
  """
110
112
  return self.properties.get("latestSupportedTlsVersion", None)
111
113
 
112
114
  @property
113
115
  def lifecycle_notification_url(self):
116
+ # type: () -> Optional[str]
114
117
  """
115
118
  Required for Teams resources if the expirationDateTime value is more than 1 hour from now; optional otherwise.
116
119
  The URL of the endpoint that receives lifecycle notifications, including subscriptionRemoved,
117
120
  reauthorizationRequired, and missed notifications. This URL must make use of the HTTPS protocol.
118
121
  For more information, see Reduce missing subscriptions and change notifications.
119
- :rtype: str or None
120
122
  """
121
123
  return self.properties.get("lifecycleNotificationUrl", None)
122
124
 
123
125
  @property
124
126
  def notification_url(self):
127
+ # type: () -> Optional[str]
125
128
  """
126
129
  Required. The URL of the endpoint that will receive the change notifications. This URL must make use of
127
130
  the HTTPS protocol. Any query string parameter included in the notificationUrl property will be included
128
131
  in the HTTP POST request when Microsoft Graph sends the change notifications.
129
- :rtype: str or None
130
132
  """
131
133
  return self.properties.get("notificationUrl", None)
132
134
 
133
135
  @property
134
136
  def resource(self):
137
+ # type: () -> Optional[str]
135
138
  """
136
139
  Specifies the resource that will be monitored for changes.
137
140
  Do not include the base URL (https://graph.microsoft.com/v1.0/). See the possible resource path values for
138
141
  each supported resource.
139
- :rtype: str or None
140
142
  """
141
143
  return self.properties.get("resource", None)
142
144
 
@@ -9,6 +9,7 @@ class TeamsApp(Entity):
9
9
 
10
10
  @property
11
11
  def app_definitions(self):
12
+ # type: () -> EntityCollection[TeamsAppDefinition]
12
13
  """The details for each version of the app."""
13
14
  return self.properties.get(
14
15
  "appDefinitions",
@@ -90,9 +90,7 @@ class Channel(Entity):
90
90
  @property
91
91
  def messages(self):
92
92
  # type: () -> EntityCollection[ChatMessage]
93
- """
94
- A collection of all the messages in the channel. A navigation property. Nullable.
95
- """
93
+ """A collection of all the messages in the channel."""
96
94
  return self.properties.get(
97
95
  "messages",
98
96
  EntityCollection(
@@ -1,10 +1,10 @@
1
1
  from typing import Callable
2
2
 
3
+ import requests
3
4
  from typing_extensions import Self
4
5
 
5
- from office365.directory.groups.group import Group
6
6
  from office365.entity_collection import EntityCollection
7
- from office365.runtime.odata.path_builder import ODataPathBuilder
7
+ from office365.runtime.paths.builder import ODataPathBuilder
8
8
  from office365.runtime.paths.resource_path import ResourcePath
9
9
  from office365.runtime.queries.create_entity import CreateEntityQuery
10
10
  from office365.teams.operations.async_operation import TeamsAsyncOperation
@@ -44,26 +44,22 @@ class TeamCollection(EntityCollection[Team]):
44
44
  return_type = Team(self.context)
45
45
  self.add_child(return_type)
46
46
 
47
- payload = {
48
- "displayName": display_name,
49
- "description": description,
50
- "template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
51
- }
52
- qry = CreateEntityQuery(self, payload, return_type)
53
- self.context.add_query(qry)
54
-
55
47
  def _process_response(resp):
56
- """
57
- :type resp: requests.Response
58
- """
48
+ # type: (requests.Response) -> None
59
49
  content_loc = resp.headers.get("Content-Location", None)
60
- team_path = ODataPathBuilder.parse(content_loc)
50
+ team_path = ODataPathBuilder.parse_url(content_loc)
61
51
  return_type.set_property("id", team_path.segment, False)
62
52
 
63
53
  loc = resp.headers.get("Location", None)
64
- operation_path = ODataPathBuilder.parse(loc)
54
+ operation_path = ODataPathBuilder.parse_url(loc)
65
55
  operation = TeamsAsyncOperation(self.context, operation_path)
66
56
  return_type.operations.add_child(operation)
67
57
 
68
- self.context.after_execute(_process_response)
58
+ payload = {
59
+ "displayName": display_name,
60
+ "description": description,
61
+ "template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
62
+ }
63
+ qry = CreateEntityQuery(self, payload, return_type)
64
+ self.context.add_query(qry).after_execute(_process_response)
69
65
  return return_type
office365/teams/info.py CHANGED
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.runtime.paths.resource_path import ResourcePath
3
5
 
@@ -5,12 +7,13 @@ from office365.runtime.paths.resource_path import ResourcePath
5
7
  class TeamInfo(Entity):
6
8
  """Represents a team with basic information."""
7
9
 
10
+ def __str__(self):
11
+ return self.display_name
12
+
8
13
  @property
9
14
  def display_name(self):
10
- """
11
- The name of the team.
12
- :rtype: str or None
13
- """
15
+ # type: () -> Optional[str]
16
+ """The name of the team."""
14
17
  return self.properties.get("displayName", None)
15
18
 
16
19
  @property
@@ -2,7 +2,7 @@ from office365.entity_collection import EntityCollection
2
2
  from office365.teams.members.conversation import ConversationMember
3
3
 
4
4
 
5
- class ConversationMemberCollection(EntityCollection):
5
+ class ConversationMemberCollection(EntityCollection[ConversationMember]):
6
6
  def __init__(self, context, resource_path=None):
7
7
  super(ConversationMemberCollection, self).__init__(
8
8
  context, ConversationMember, resource_path
@@ -18,8 +18,6 @@ class ConversationMemberCollection(EntityCollection):
18
18
  Each member must be assigned a role of owner or guest. Guest tenant members must be assigned the guest role
19
19
  :param list[str] roles: The roles for that user.
20
20
  :param datetime.datetime visible_history_start_datetime:
21
-
22
- :rtype: ConversationMember
23
21
  """
24
22
  return_type = super(ConversationMemberCollection, self).add(roles=roles)
25
23
  from office365.directory.users.user import User
@@ -68,16 +68,14 @@ class TeamsAsyncOperation(Entity):
68
68
 
69
69
  @property
70
70
  def target_resource_location(self):
71
+ # type: () -> Optional[str]
71
72
  """The location of the object that's created or modified as result of this async operation.
72
73
  This URL should be treated as an opaque value and not parsed into its component paths.
73
- :rtype: str or None
74
74
  """
75
75
  return self.properties.get("targetResourceLocation", None)
76
76
 
77
77
  @property
78
78
  def status(self):
79
- """
80
- Operation status.
81
- :rtype: str
82
- """
79
+ # type: () -> Optional[str]
80
+ """Operation status."""
83
81
  return self.properties.get("status", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.types.collections import StringCollection
2
4
  from office365.teams.schedule.change_tracked_entity import ChangeTrackedEntity
3
5
 
@@ -7,6 +9,7 @@ class SchedulingGroup(ChangeTrackedEntity):
7
9
 
8
10
  @property
9
11
  def is_active(self):
12
+ # type: () -> Optional[bool]
10
13
  """Indicates whether the schedulingGroup can be used when creating new entities or updating existing ones"""
11
14
  return self.properties.get("isActive", None)
12
15
 
office365/teams/team.py CHANGED
@@ -25,11 +25,12 @@ class Team(Entity):
25
25
  """A team in Microsoft Teams is a collection of channel objects. A channel represents a topic, and therefore a
26
26
  logical isolation of discussion, within a team."""
27
27
 
28
+ def __str__(self):
29
+ return self.display_name
30
+
28
31
  def execute_query_and_wait(self):
29
32
  """
30
33
  Submit request(s) to the server and waits until operation is completed
31
-
32
- :type self: T
33
34
  """
34
35
 
35
36
  def _loaded():
@@ -79,18 +80,15 @@ class Team(Entity):
79
80
 
80
81
  @property
81
82
  def description(self):
82
- """An optional description for the team.
83
-
84
- :rtype: str or None
85
- """
83
+ # type: () -> Optional[str]
84
+ """An optional description for the team."""
86
85
  return self.properties.get("description", None)
87
86
 
88
87
  @property
89
88
  def classification(self):
89
+ # type: () -> Optional[str]
90
90
  """An optional label. Typically describes the data or business sensitivity of the team.
91
91
  Must match one of a pre-configured set in the tenant's directory.
92
-
93
- :rtype: str or None
94
92
  """
95
93
  return self.properties.get("classification", None)
96
94
 
@@ -107,6 +105,7 @@ class Team(Entity):
107
105
 
108
106
  @property
109
107
  def web_url(self):
108
+ # type: () -> Optional[str]
110
109
  """A hyperlink that will go to the team in the Microsoft Teams client. This is the URL that you get when
111
110
  you right-click a team in the Microsoft Teams client and select Get link to team. This URL should be treated
112
111
  as an opaque blob, and not parsed."""
@@ -119,6 +118,7 @@ class Team(Entity):
119
118
 
120
119
  @property
121
120
  def all_channels(self):
121
+ # type: () -> ChannelCollection
122
122
  """
123
123
  List of channels either hosted in or shared with the team (incoming channels).
124
124
  """
@@ -131,9 +131,8 @@ class Team(Entity):
131
131
 
132
132
  @property
133
133
  def incoming_channels(self):
134
- """
135
- List of channels shared with the team.
136
- """
134
+ # type: () -> ChannelCollection
135
+ """List of channels shared with the team."""
137
136
  return self.properties.get(
138
137
  "incomingChannels",
139
138
  ChannelCollection(
@@ -164,9 +163,7 @@ class Team(Entity):
164
163
  @property
165
164
  def primary_channel(self):
166
165
  # type: () -> Channel
167
- """
168
- The general channel for the team.
169
- """
166
+ """The general channel for the team."""
170
167
  return self.properties.get(
171
168
  "primaryChannel",
172
169
  Channel(self.context, ResourcePath("primaryChannel", self.resource_path)),
@@ -195,6 +192,7 @@ class Team(Entity):
195
192
 
196
193
  @property
197
194
  def operations(self):
195
+ # type: () -> EntityCollection[TeamsAsyncOperation]
198
196
  """The async operations that ran or are running on this team."""
199
197
  return self.properties.setdefault(
200
198
  "operations",
@@ -207,6 +205,7 @@ class Team(Entity):
207
205
 
208
206
  @property
209
207
  def permission_grants(self):
208
+ # type: () -> EntityCollection[ResourceSpecificPermissionGrant]
210
209
  """
211
210
  List all resource-specific permission grants
212
211
  """
@@ -226,10 +225,8 @@ class Team(Entity):
226
225
 
227
226
  @property
228
227
  def tenant_id(self):
229
- """
230
- The ID of the Azure Active Directory tenant.
231
- :rtype: str
232
- """
228
+ # type: () -> Optional[str]
229
+ """The ID of the Azure Active Directory tenant."""
233
230
  return self.properties.get("tenantId", None)
234
231
 
235
232
  @property
@@ -293,8 +290,9 @@ class Team(Entity):
293
290
  :param str preview_text: Preview text for the notification. Microsoft Teams will only show first 150 characters
294
291
  :param dict template_parameters: Values for template variables defined in the activity feed entry corresponding
295
292
  to activityType in Teams app manifest.
296
- :param teamworkNotificationRecipient template_parameters: Recipient of the notification.
293
+ :param dict template_parameters: Recipient of the notification.
297
294
  Only Azure AD users are supported.
295
+ :param teamworkNotificationRecipient recipient: Recipient of the notification
298
296
  """
299
297
  payload = {
300
298
  "topic": topic,
@@ -323,6 +321,6 @@ class Team(Entity):
323
321
  def set_property(self, name, value, persist_changes=True):
324
322
  super(Team, self).set_property(name, value, persist_changes)
325
323
  # fallback: determine whether resource path is resolved
326
- if name == "id" and self._resource_path.key == "team":
324
+ if name == "id" and self._resource_path.segment == "team":
327
325
  self._resource_path = ResourcePath(value, ResourcePath("teams"))
328
326
  return self
@@ -1,4 +1,5 @@
1
1
  import datetime
2
+ from typing import Optional
2
3
 
3
4
  from office365.entity import Entity
4
5
 
@@ -9,14 +10,13 @@ class AttachmentBase(Entity):
9
10
 
10
11
  @property
11
12
  def content_type(self):
12
- """
13
- The MIME type.
14
- :rtype: str or None
15
- """
13
+ # type: () -> Optional[str]
14
+ """The MIME type."""
16
15
  return self.properties.get("contentType", None)
17
16
 
18
17
  @property
19
18
  def last_modified_datetime(self):
19
+ # type: () -> Optional[datetime.datetime]
20
20
  """
21
21
  The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time.
22
22
  """
@@ -24,16 +24,14 @@ class AttachmentBase(Entity):
24
24
 
25
25
  @property
26
26
  def name(self):
27
+ # type: () -> Optional[str]
27
28
  """
28
29
  The display name of the attachment. This does not need to be the actual file name.
29
- :rtype: str or None
30
30
  """
31
31
  return self.properties.get("name", None)
32
32
 
33
33
  @property
34
34
  def size(self):
35
- """
36
- The length of the attachment in bytes.
37
- :rtype: int or None
38
- """
35
+ # type: () -> Optional[int]
36
+ """The length of the attachment in bytes."""
39
37
  return self.properties.get("size", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
 
3
5
 
@@ -9,14 +11,12 @@ class LinkedResource(Entity):
9
11
 
10
12
  @property
11
13
  def application_name(self):
12
- """Field indicating the app name of the source that is sending the linkedResource.
13
- :rtype: str
14
- """
14
+ # type: () -> Optional[str]
15
+ """Field indicating the app name of the source that is sending the linkedResource."""
15
16
  return self.properties.get("applicationName", None)
16
17
 
17
18
  @property
18
19
  def display_name(self):
19
- """The title of the linkedResource..
20
- :rtype: str
21
- """
20
+ # type: () -> Optional[str]
21
+ """The title of the linkedResource."""
22
22
  return self.properties.get("displayName", None)
@@ -10,6 +10,7 @@ class TodoTaskList(Entity):
10
10
 
11
11
  @property
12
12
  def extensions(self):
13
+ # type: () -> EntityCollection[Extension]
13
14
  """The collection of open extensions defined for the task list."""
14
15
  return self.properties.get(
15
16
  "extensions",
@@ -11,6 +11,7 @@ class TodoTask(Entity):
11
11
 
12
12
  @property
13
13
  def extensions(self):
14
+ # type: () -> EntityCollection[Extension]
14
15
  """The collection of open extensions defined for the task."""
15
16
  return self.properties.get(
16
17
  "extensions",
@@ -21,6 +22,7 @@ class TodoTask(Entity):
21
22
 
22
23
  @property
23
24
  def checklist_items(self):
25
+ # type: () -> EntityCollection[ChecklistItem]
24
26
  """A collection of checklistItems linked to a task."""
25
27
  return self.properties.get(
26
28
  "checklistItems",
@@ -33,6 +35,7 @@ class TodoTask(Entity):
33
35
 
34
36
  @property
35
37
  def linked_resources(self):
38
+ # type: () -> EntityCollection[LinkedResource]
36
39
  """A collection of resources linked to the task."""
37
40
  return self.properties.get(
38
41
  "linkedResources",
@@ -1,36 +0,0 @@
1
- import os
2
-
3
- from office365.onedrive.driveitems.uploadable_properties import (
4
- DriveItemUploadableProperties,
5
- )
6
- from office365.runtime.odata.v4.upload_session_request import UploadSessionRequest
7
- from office365.runtime.queries.upload_session import UploadSessionQuery
8
-
9
-
10
- def create_resumable_file_upload_query(
11
- return_type, local_path, chunk_size, chunk_uploaded
12
- ):
13
- """
14
- :type return_type: office365.onedrive.driveitems.driveItem.DriveItem
15
- :type local_path: str
16
- :type chunk_size: int
17
- :type chunk_uploaded: (int)->None
18
- """
19
- item = DriveItemUploadableProperties()
20
- item.name = os.path.basename(local_path)
21
- qry = UploadSessionQuery(return_type, {"item": item})
22
- context = return_type.context
23
-
24
- def _start_upload(resp):
25
- """
26
- :type resp: requests.Response
27
- """
28
- resp.raise_for_status()
29
- with open(local_path, "rb") as local_file:
30
- session_request = UploadSessionRequest(
31
- local_file, chunk_size, chunk_uploaded
32
- )
33
- session_request.execute_query(qry)
34
-
35
- context.after_execute(_start_upload)
36
- return qry
@@ -1,53 +0,0 @@
1
- from office365.outlook.mail.attachments.attachment_item import AttachmentItem
2
- from office365.runtime.compat import parse_query_string
3
- from office365.runtime.odata.v4.upload_session_request import UploadSessionRequest
4
- from office365.runtime.queries.upload_session import UploadSessionQuery
5
-
6
-
7
- def create_attachment_upload_query(
8
- binding_type, return_type, source_path, chunk_size=1000000, chunk_uploaded=None
9
- ):
10
- """
11
- :type binding_type: office365.outlook.mail.attachments.collection.AttachmentCollection
12
- :type return_type: FileAttachment
13
- :type source_path: str
14
- :type chunk_size: int
15
- :type chunk_uploaded: (int)->None
16
- """
17
- qry = UploadSessionQuery(
18
- binding_type, {"AttachmentItem": AttachmentItem.create_file(source_path)}
19
- )
20
- context = binding_type.context
21
-
22
- def _start_upload(resp):
23
- """
24
- :type resp: requests.Response
25
- """
26
- resp.raise_for_status()
27
- with open(source_path, "rb") as local_file:
28
- session_request = UploadSessionRequest(
29
- local_file, chunk_size, chunk_uploaded
30
- )
31
-
32
- def _construct_request(request):
33
- auth_token = parse_query_string(request.url, "authtoken")
34
- request.set_header("Authorization", "Bearer {0}".format(auth_token))
35
-
36
- session_request.beforeExecute += _construct_request
37
-
38
- def _process_response(response):
39
- """
40
- :type response: requests.Response
41
- """
42
- location = response.headers.get("Location", None)
43
- if location is None:
44
- return
45
- attachment_id = location[location.find("Attachments(") + 13 : -2]
46
- return_type.set_property("id", attachment_id)
47
-
48
- session_request.afterExecute += _process_response
49
-
50
- session_request.execute_query(qry)
51
-
52
- context.after_execute(_start_upload)
53
- return qry
@@ -1,23 +0,0 @@
1
- import json
2
- import re
3
-
4
- from office365.runtime.client_value import ClientValue
5
- from office365.runtime.compat import is_string_type
6
- from office365.runtime.paths.resource_path import ResourcePath
7
-
8
-
9
- class ODataPathBuilder(object):
10
- @staticmethod
11
- def parse(path_str):
12
- """
13
- Parses path from a string
14
-
15
- :param str path_str:
16
- """
17
- segments = [n for n in re.split(r"[('')]|/", path_str) if n]
18
- if not segments:
19
- raise TypeError("Invalid path")
20
- path = None
21
- for segment in segments:
22
- path = ResourcePath(segment, path)
23
- return path
@@ -1,28 +0,0 @@
1
- from office365.runtime.client_value import ClientValue
2
- from office365.runtime.client_value_collection import ClientValueCollection
3
-
4
-
5
- class KeyValue(ClientValue):
6
- """Represents a key value pair."""
7
-
8
- def __init__(self, key=None, value=None, value_type=None):
9
- """
10
- :param str key: The value of the key in the key value pair.
11
- :param str value: The string representation of the value in the key value pair.
12
- :param str value_type: The EDM type name of the value in the key value pair.
13
- """
14
- self.Key = key
15
- self.Value = value
16
- self.ValueType = value_type
17
-
18
- @property
19
- def entity_type_name(self):
20
- return "SP.KeyValue"
21
-
22
-
23
- class KeyValueCollection(ClientValueCollection):
24
- def __init__(self, initial_values=None):
25
- """
26
- :type initial_values: list[KeyValue] or None
27
- """
28
- super(KeyValueCollection, self).__init__(KeyValue, initial_values)