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 json
2
+ from typing import Optional
2
3
 
3
4
  from office365.communications.onlinemeetings.collection import OnlineMeetingCollection
4
5
  from office365.communications.presences.presence import Presence
@@ -54,8 +55,8 @@ from office365.runtime.client_result import ClientResult
54
55
  from office365.runtime.client_value_collection import ClientValueCollection
55
56
  from office365.runtime.http.http_method import HttpMethod
56
57
  from office365.runtime.http.request_options import RequestOptions
57
- from office365.runtime.paths.entity import EntityPath
58
58
  from office365.runtime.paths.resource_path import ResourcePath
59
+ from office365.runtime.paths.v4.entity import EntityPath
59
60
  from office365.runtime.queries.create_entity import CreateEntityQuery
60
61
  from office365.runtime.queries.function import FunctionQuery
61
62
  from office365.runtime.queries.service_operation import ServiceOperationQuery
@@ -70,6 +71,9 @@ from office365.todo.todo import Todo
70
71
  class User(DirectoryObject):
71
72
  """Represents an Azure AD user account. Inherits from directoryObject."""
72
73
 
74
+ def __repr__(self):
75
+ return self.user_principal_name or self.id or self.entity_type_name
76
+
73
77
  def add_extension(self, name):
74
78
  """
75
79
  Creates an open extension (openTypeExtension object) and add custom properties in a new or existing instance
@@ -141,9 +145,7 @@ class User(DirectoryObject):
141
145
  qry = ServiceOperationQuery(self.manager, "$ref")
142
146
 
143
147
  def _construct_request(request):
144
- """
145
- :type request: office365.runtime.http.request_options.RequestOptions
146
- """
148
+ # type: (RequestOptions) -> None
147
149
  request.method = HttpMethod.Delete
148
150
 
149
151
  self.context.add_query(qry).before_query_execute(_construct_request)
@@ -445,9 +447,7 @@ class User(DirectoryObject):
445
447
 
446
448
  @property
447
449
  def device_enrollment_limit(self):
448
- """
449
- :rtype: str
450
- """
450
+ # type: () -> Optional[str]
451
451
  return self.properties.get("deviceEnrollmentLimit", None)
452
452
 
453
453
  @property
@@ -457,15 +457,14 @@ class User(DirectoryObject):
457
457
 
458
458
  @property
459
459
  def account_enabled(self):
460
+ # type: () -> Optional[bool]
460
461
  """True if the account is enabled; otherwise, false. This property is required when a user is created."""
461
462
  return self.properties.get("accountEnabled", None)
462
463
 
463
464
  @property
464
465
  def age_group(self):
465
- """
466
- Gets the age group of the user.
467
- :rtype: str or None
468
- """
466
+ # type: () -> Optional[str]
467
+ """Gets the age group of the user"""
469
468
  return self.properties.get("ageGroup", None)
470
469
 
471
470
  @property
@@ -489,15 +488,15 @@ class User(DirectoryObject):
489
488
 
490
489
  @property
491
490
  def given_name(self):
491
+ # type: () -> Optional[str]
492
492
  """
493
493
  The given name (first name) of the user. Maximum length is 64 characters.
494
-
495
- :rtype: str or None
496
494
  """
497
495
  return self.properties.get("givenName", None)
498
496
 
499
497
  @property
500
498
  def user_principal_name(self):
499
+ # type: () -> Optional[str]
501
500
  """
502
501
  The user principal name (UPN) of the user. The UPN is an Internet-style login name for the user based on the
503
502
  Internet standard RFC 822. By convention, this should map to the user's email name.
@@ -507,8 +506,6 @@ class User(DirectoryObject):
507
506
  NOTE: This property cannot contain accent characters.
508
507
  Only the following characters are allowed A - Z, a - z, 0 - 9, ' . - _ ! # ^ ~.
509
508
  For the complete list of allowed characters, see username policies.
510
-
511
- :rtype: str or None
512
509
  """
513
510
  return self.properties.get("userPrincipalName", None)
514
511
 
@@ -538,6 +535,7 @@ class User(DirectoryObject):
538
535
 
539
536
  @property
540
537
  def creation_type(self):
538
+ # type: () -> Optional[str]
541
539
  """Indicates whether the user account was created as a regular school or work account (null),
542
540
  an external account (Invitation), a local account for an Azure Active Directory B2C tenant (LocalAccount)
543
541
  or self-service sign-up using email verification (EmailVerified). Read-only.
@@ -556,6 +554,7 @@ class User(DirectoryObject):
556
554
 
557
555
  @property
558
556
  def mail(self):
557
+ # type: () -> Optional[str]
559
558
  """The SMTP address for the user, for example, "jeff@contoso.onmicrosoft.com".
560
559
  Returned by default. Supports $filter and endsWith.
561
560
  """
@@ -625,9 +624,7 @@ class User(DirectoryObject):
625
624
 
626
625
  @property
627
626
  def photo(self):
628
- """
629
- The user's profile photo. Read-only.
630
- """
627
+ """The user's profile photo. Read-only."""
631
628
  return self.properties.get(
632
629
  "photo",
633
630
  ProfilePhoto(self.context, ResourcePath("photo", self.resource_path)),
@@ -635,9 +632,7 @@ class User(DirectoryObject):
635
632
 
636
633
  @property
637
634
  def manager(self):
638
- """
639
- The user or contact that is this user's manager
640
- """
635
+ """The user or contact that is this user's manager"""
641
636
  return self.properties.get(
642
637
  "manager",
643
638
  DirectoryObject(self.context, ResourcePath("manager", self.resource_path)),
@@ -645,17 +640,15 @@ class User(DirectoryObject):
645
640
 
646
641
  @property
647
642
  def preferred_language(self):
643
+ # type: () -> Optional[str]
648
644
  """
649
645
  The preferred language for the user. Should follow ISO 639-1 Code; for example en-US.
650
- :rtype: str or None
651
646
  """
652
647
  return self.properties.get("preferredLanguage", None)
653
648
 
654
649
  @property
655
650
  def mailbox_settings(self):
656
- """
657
- Get the user's mailboxSettings.
658
- """
651
+ """Get the user's mailboxSettings."""
659
652
  return self.properties.get("mailboxSettings", MailboxSettings())
660
653
 
661
654
  @property
@@ -680,6 +673,7 @@ class User(DirectoryObject):
680
673
 
681
674
  @property
682
675
  def calendar_groups(self):
676
+ # type: () -> EntityCollection[CalendarGroup]
683
677
  """The user's calendar groups. Read-only. Nullable."""
684
678
  return self.properties.get(
685
679
  "calendarGroups",
@@ -692,6 +686,7 @@ class User(DirectoryObject):
692
686
 
693
687
  @property
694
688
  def license_details(self):
689
+ # type: () -> EntityCollection[LicenseDetails]
695
690
  """Retrieve the properties and relationships of a Drive resource."""
696
691
  return self.properties.get(
697
692
  "licenseDetails",
@@ -798,6 +793,7 @@ class User(DirectoryObject):
798
793
 
799
794
  @property
800
795
  def oauth2_permission_grants(self):
796
+ # type: () -> DeltaCollection[OAuth2PermissionGrant]
801
797
  """"""
802
798
  return self.properties.get(
803
799
  "oauth2PermissionGrants",
@@ -810,20 +806,20 @@ class User(DirectoryObject):
810
806
 
811
807
  @property
812
808
  def on_premises_distinguished_name(self):
809
+ # type: () -> Optional[str]
813
810
  """
814
811
  Contains the on-premises Active Directory distinguished name or DN. The property is only populated for
815
812
  customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect
816
- :rtype: str
817
813
  """
818
814
  return self.properties.get("onPremisesDistinguishedName", None)
819
815
 
820
816
  @property
821
817
  def on_premises_domain_name(self):
818
+ # type: () -> Optional[str]
822
819
  """
823
820
  Contains the on-premises domainFQDN, also called dnsDomainName synchronized from the on-premises directory.
824
821
  The property is only populated for customers who are synchronizing their on-premises directory to
825
822
  Azure Active Directory via Azure AD Connect.
826
- :rtype: str
827
823
  """
828
824
  return self.properties.get("onPremisesDomainName", None)
829
825
 
@@ -919,6 +915,7 @@ class User(DirectoryObject):
919
915
 
920
916
  @property
921
917
  def extensions(self):
918
+ # type: () -> EntityCollection[Extension]
922
919
  """The collection of open extensions defined for the user. Nullable."""
923
920
  return self.properties.get(
924
921
  "extensions",
@@ -929,9 +926,7 @@ class User(DirectoryObject):
929
926
 
930
927
  @property
931
928
  def direct_reports(self):
932
- """
933
- Get a user's direct reports.
934
- """
929
+ """Get a user's direct reports"""
935
930
  return self.properties.get(
936
931
  "directReports",
937
932
  DirectoryObjectCollection(
@@ -953,12 +948,12 @@ class User(DirectoryObject):
953
948
 
954
949
  @property
955
950
  def password_policies(self):
951
+ # type: () -> Optional[str]
956
952
  """
957
953
  Specifies password policies for the user. This value is an enumeration with one possible value being
958
954
  DisableStrongPassword, which allows weaker passwords than the default policy to be specified.
959
955
  DisablePasswordExpiration can also be specified. The two may be specified together; for example:
960
956
  DisablePasswordExpiration, DisableStrongPassword.
961
- :rtype: str
962
957
  """
963
958
  return self.properties.get("passwordPolicies", None)
964
959
 
@@ -991,17 +986,17 @@ class User(DirectoryObject):
991
986
 
992
987
  @property
993
988
  def street_address(self):
989
+ # type: () -> Optional[str]
994
990
  """
995
991
  The street address of the user's place of business. Maximum length is 1024 characters.
996
- :rtype: str
997
992
  """
998
993
  return self.properties.get("streetAddress", None)
999
994
 
1000
995
  @property
1001
996
  def security_identifier(self):
997
+ # type: () -> Optional[str]
1002
998
  """
1003
999
  Security identifier (SID) of the user, used in Windows scenarios.
1004
- :rtype: str
1005
1000
  """
1006
1001
  return self.properties.get("securityIdentifier", None)
1007
1002
 
@@ -1033,10 +1028,10 @@ class User(DirectoryObject):
1033
1028
 
1034
1029
  @property
1035
1030
  def usage_location(self):
1031
+ # type: () -> Optional[str]
1036
1032
  """
1037
1033
  A two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to
1038
1034
  legal requirement to check for availability of services in countries. Examples include: US, JP, and GB.
1039
- :rtype: str
1040
1035
  """
1041
1036
  return self.properties.get("usageLocation", None)
1042
1037
 
office365/entity.py CHANGED
@@ -3,8 +3,8 @@ from typing import TYPE_CHECKING, Optional, TypeVar
3
3
  from typing_extensions import Self
4
4
 
5
5
  from office365.runtime.client_object import ClientObject
6
- from office365.runtime.paths.entity import EntityPath
7
6
  from office365.runtime.paths.resource_path import ResourcePath
7
+ from office365.runtime.paths.v4.entity import EntityPath
8
8
  from office365.runtime.queries.delete_entity import DeleteEntityQuery
9
9
  from office365.runtime.queries.update_entity import UpdateEntityQuery
10
10
 
@@ -72,5 +72,5 @@ class Entity(ClientObject[T]):
72
72
  value, self.parent_collection.resource_path
73
73
  )
74
74
  else:
75
- self._resource_path.patch(value, inplace=True)
75
+ self._resource_path.patch(value)
76
76
  return self
@@ -5,6 +5,7 @@ from office365.runtime.client_object_collection import ClientObjectCollection
5
5
  from office365.runtime.compat import is_string_type
6
6
  from office365.runtime.paths.item import ItemPath
7
7
  from office365.runtime.paths.resource_path import ResourcePath
8
+ from office365.runtime.paths.v4.entity import EntityPath
8
9
  from office365.runtime.queries.create_entity import CreateEntityQuery
9
10
 
10
11
  if TYPE_CHECKING:
@@ -28,11 +29,11 @@ class EntityCollection(ClientObjectCollection[T]):
28
29
  :param key: key is used to address an entity by either an index or by identifier
29
30
  :type key: int or str
30
31
  """
31
- if type(key) == int:
32
+ if isinstance(key, int):
32
33
  return super(EntityCollection, self).__getitem__(key)
33
34
  elif is_string_type(key):
34
35
  return self.create_typed_object(
35
- resource_path=ResourcePath(key, self.resource_path)
36
+ resource_path=EntityPath(key, self.resource_path)
36
37
  )
37
38
  else:
38
39
  raise ValueError(
@@ -41,15 +42,21 @@ class EntityCollection(ClientObjectCollection[T]):
41
42
 
42
43
  def add(self, **kwargs):
43
44
  # type: (Any) -> T
44
- """
45
- Creates an entity and prepares the query
46
- """
45
+ """Creates an entity and prepares the query"""
47
46
  return_type = self.create_typed_object(kwargs, ItemPath(self.resource_path))
48
47
  self.add_child(return_type)
49
48
  qry = CreateEntityQuery(self, return_type, return_type)
50
49
  self.context.add_query(qry)
51
50
  return return_type
52
51
 
52
+ def create_typed_object(self, initial_properties=None, resource_path=None):
53
+ # type: (Optional[dict], Optional[ResourcePath]) -> T
54
+ if resource_path is None:
55
+ resource_path = EntityPath(None, self.resource_path)
56
+ return super(EntityCollection, self).create_typed_object(
57
+ initial_properties, resource_path
58
+ )
59
+
53
60
  @property
54
61
  def context(self):
55
62
  # type: () -> GraphClient
office365/graph_client.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Callable, List
1
+ from typing import Any, Callable, List, Optional
2
2
 
3
3
  from office365.booking.solutions.root import SolutionsRoot
4
4
  from office365.communications.cloud_communications import CloudCommunications
@@ -43,6 +43,7 @@ from office365.onedrive.drives.drive import Drive
43
43
  from office365.onedrive.shares.collection import SharesCollection
44
44
  from office365.onedrive.sites.sites_with_root import SitesWithRoot
45
45
  from office365.outlook.calendar.place import Place
46
+ from office365.outlook.calendar.rooms.list import RoomList
46
47
  from office365.planner.planner import Planner
47
48
  from office365.reports.root import ReportRoot
48
49
  from office365.runtime.auth.token_response import TokenResponse
@@ -79,10 +80,48 @@ class GraphClient(ClientRuntimeContext):
79
80
  self._authority_host_url = "https://login.microsoftonline.com"
80
81
  self._acquire_token_callback = acquire_token_callback
81
82
 
83
+ @staticmethod
84
+ def with_certificate(
85
+ tenant, client_id, thumbprint, private_key, scopes=None, token_cache=None
86
+ ):
87
+ """
88
+ Initializes the confidential client with client certificate
89
+
90
+ :param str tenant: Tenant name, for example: contoso.onmicrosoft.com
91
+ :param str client_id: The OAuth client id of the calling application.
92
+ :param str thumbprint: Thumbprint
93
+ :param str private_key: Private key
94
+ :param list[str] or None scopes: Scopes requested to access an API
95
+ :param Any token_cache: Default cache is in memory only,
96
+ Refer https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache
97
+ """
98
+ if scopes is None:
99
+ scopes = ["https://graph.microsoft.com/.default"]
100
+ authority_url = "https://login.microsoftonline.com/{0}".format(tenant)
101
+ import msal
102
+
103
+ app = msal.ConfidentialClientApplication(
104
+ client_id,
105
+ authority=authority_url,
106
+ client_credential={
107
+ "thumbprint": thumbprint,
108
+ "private_key": private_key,
109
+ },
110
+ token_cache=token_cache # Default cache is in memory only.
111
+ # You can learn how to use SerializableTokenCache from
112
+ # https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache
113
+ )
114
+
115
+ def _acquire_token():
116
+ return app.acquire_token_for_client(scopes=scopes)
117
+
118
+ return GraphClient(_acquire_token)
119
+
82
120
  @staticmethod
83
121
  def with_client_secret(
84
122
  tenant, client_id, client_secret, scopes=None, token_cache=None
85
123
  ):
124
+ # type: (str, str, str, List[str], Any) -> "GraphClient"
86
125
  """
87
126
  Initializes the confidential client with client secret
88
127
 
@@ -106,7 +145,45 @@ class GraphClient(ClientRuntimeContext):
106
145
  )
107
146
 
108
147
  def _acquire_token():
109
- result = app.acquire_token_for_client(scopes=scopes)
148
+ return app.acquire_token_for_client(scopes=scopes)
149
+
150
+ return GraphClient(_acquire_token)
151
+
152
+ @staticmethod
153
+ def with_token_interactive(tenant, client_id, username=None, scopes=None):
154
+ # type: (str, str, Optional[str], List[str]) -> "GraphClient"
155
+ """
156
+ Initializes the client via user credentials
157
+ Note: only works if your app is registered with redirect_uri as http://localhost
158
+
159
+ :param str tenant: Tenant name, for example: contoso.onmicrosoft.com
160
+ :param str client_id: The OAuth client id of the calling application.
161
+ :param str username: Typically a UPN in the form of an email address.
162
+ :param list[str] or None scopes: Scopes requested to access an API
163
+ """
164
+ if scopes is None:
165
+ scopes = ["https://graph.microsoft.com/.default"]
166
+ authority_url = "https://login.microsoftonline.com/{0}".format(tenant)
167
+ import msal
168
+
169
+ app = msal.PublicClientApplication(client_id, authority=authority_url)
170
+
171
+ def _acquire_token():
172
+ # The pattern to acquire a token looks like this.
173
+ result = None
174
+
175
+ # Firstly, check the cache to see if this end user has signed in before
176
+ accounts = app.get_accounts(username=username)
177
+ if accounts:
178
+ chosen = accounts[0] # Assuming the end user chose this one to proceed
179
+ # Now let's try to find a token in cache for this account
180
+ result = app.acquire_token_silent(scopes, account=chosen)
181
+
182
+ if not result:
183
+ result = app.acquire_token_interactive(
184
+ scopes,
185
+ login_hint=username,
186
+ )
110
187
  return result
111
188
 
112
189
  return GraphClient(_acquire_token)
@@ -393,18 +470,23 @@ class GraphClient(ClientRuntimeContext):
393
470
 
394
471
  @property
395
472
  def audit_logs(self):
396
- """
397
- Get the list of audit logs generated by Azure Active Directory.
398
- """
473
+ """Gets the list of audit logs generated by Azure Active Directory."""
399
474
  return AuditLogRoot(self, ResourcePath("auditLogs"))
400
475
 
401
476
  @property
402
477
  def places(self):
403
- """
404
- Get all places in a tenant
405
- """
478
+ """Gets all places in a tenant"""
406
479
  return EntityCollection(self, Place, ResourcePath("places"))
407
480
 
481
+ @property
482
+ def room_lists(self):
483
+ """Gets all the room lists in a tenant"""
484
+ return EntityCollection(
485
+ self,
486
+ RoomList,
487
+ ResourcePath("microsoft.graph.roomlist", ResourcePath("places")),
488
+ )
489
+
408
490
  @property
409
491
  def reports(self):
410
492
  """Represents a container for Azure Active Directory (Azure AD) reporting resources."""
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.intune.audit.actor import AuditActor
3
5
  from office365.intune.audit.resource import AuditResource
@@ -9,9 +11,8 @@ class AuditEvent(Entity):
9
11
 
10
12
  @property
11
13
  def activity(self):
12
- """Friendly name of the activity.
13
- :rtype: str
14
- """
14
+ # type: () -> Optional[str]
15
+ """Friendly name of the activity."""
15
16
  return self.properties.get("activity", None)
16
17
 
17
18
  @property
@@ -1,4 +1,5 @@
1
1
  import datetime
2
+ from typing import Optional
2
3
 
3
4
  from office365.entity import Entity
4
5
 
@@ -6,6 +7,9 @@ from office365.entity import Entity
6
7
  class DeviceEnrollmentConfiguration(Entity):
7
8
  """The Base Class of Device Enrollment Configuration"""
8
9
 
10
+ def __str__(self):
11
+ return self.display_name
12
+
9
13
  @property
10
14
  def created_datetime(self):
11
15
  """
@@ -15,10 +19,8 @@ class DeviceEnrollmentConfiguration(Entity):
15
19
 
16
20
  @property
17
21
  def display_name(self):
18
- """
19
- The display name of the device enrollment configuration
20
- :rtype: str
21
- """
22
+ # type: () -> Optional[str]
23
+ """The display name of the device enrollment configuration"""
22
24
  return self.properties.get("displayName", None)
23
25
 
24
26
  def get_property(self, name, default_value=None):
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.entity_collection import EntityCollection
3
5
  from office365.intune.devices.category import DeviceCategory
@@ -17,12 +19,12 @@ class ManagedDevice(Entity):
17
19
 
18
20
  @property
19
21
  def activation_lock_bypass_code(self):
22
+ # type: () -> Optional[str]
20
23
  """
21
24
  The code that allows the Activation Lock on managed device to be bypassed. Default,
22
25
  is Null (Non-Default property) for this property when returned as part of managedDevice entity in LIST call.
23
26
  To retrieve actual values GET call needs to be made, with device id and included in select parameter.
24
27
  Supports: $select. $Search is not supported. Read-only. This property is read-only.
25
- :rtype: str
26
28
  """
27
29
  return self.properties.get("activationLockBypassCode", None)
28
30
 
@@ -38,25 +40,20 @@ class ManagedDevice(Entity):
38
40
 
39
41
  @property
40
42
  def manufacturer(self):
41
- """
42
- Manufacturer of the device.
43
- :rtype: str
44
- """
43
+ # type: () -> Optional[str]
44
+ """Manufacturer of the device."""
45
45
  return self.properties.get("manufacturer", None)
46
46
 
47
47
  @property
48
48
  def operating_system(self):
49
- """
50
- Manufacturer of the device.
51
- :rtype: str
52
- """
49
+ # type: () -> Optional[str]
50
+ """Manufacturer of the device."""
53
51
  return self.properties.get("operatingSystem", None)
54
52
 
55
53
  @property
56
54
  def device_compliance_policy_states(self):
57
- """
58
- Device compliance policy states for this device
59
- """
55
+ # type: () -> EntityCollection[DeviceCompliancePolicyState]
56
+ """Device compliance policy states for this device"""
60
57
  return self.properties.get(
61
58
  "deviceCompliancePolicyStates",
62
59
  EntityCollection(
@@ -1,4 +1,5 @@
1
1
  from datetime import datetime
2
+ from typing import Optional
2
3
 
3
4
  from office365.entity import Entity
4
5
  from office365.entity_collection import EntityCollection
@@ -38,9 +39,8 @@ class ItemActivityStat(Entity):
38
39
 
39
40
  @property
40
41
  def is_trending(self):
41
- """Indicates whether the item is trending.
42
- :rtype: bool or None
43
- """
42
+ # type: () -> Optional[bool]
43
+ """Indicates whether the item is trending."""
44
44
  return self.properties.get("isTrending", None)
45
45
 
46
46
  @property
@@ -55,6 +55,7 @@ class ItemActivityStat(Entity):
55
55
 
56
56
  @property
57
57
  def activities(self):
58
+ # type: () -> EntityCollection[ItemActivity]
58
59
  """Exposes the itemActivities represented in this itemActivityStat resource."""
59
60
  return self.properties.get(
60
61
  "activities",
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
 
3
5
 
@@ -6,8 +8,6 @@ class ColumnLink(Entity):
6
8
 
7
9
  @property
8
10
  def name(self):
9
- """
10
- The name of the column in this content type.
11
- :rtype: str or None
12
- """
11
+ # type: () -> Optional[str]
12
+ """The name of the column in this content type."""
13
13
  return self.properties.get("name", None)