Office365-REST-Python-Client 2.5.5__py3-none-any.whl → 2.5.7__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 (270) hide show
  1. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/METADATA +6 -6
  2. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/RECORD +269 -222
  3. office365/booking/virtualevents/__init__.py +0 -0
  4. office365/booking/virtualevents/root.py +5 -0
  5. office365/communications/calls/participant.py +4 -5
  6. office365/directory/administrative_unit.py +9 -2
  7. office365/directory/applications/application.py +3 -3
  8. office365/directory/applications/roles/assignment_collection.py +1 -1
  9. office365/directory/applications/roles/collection.py +6 -2
  10. office365/directory/applications/roles/role.py +1 -1
  11. office365/directory/audit/provisioning/object_summary.py +30 -1
  12. office365/directory/authentication/method_configuration.py +9 -0
  13. office365/directory/authentication/method_mode_detail.py +8 -0
  14. office365/directory/authentication/method_target.py +5 -0
  15. office365/directory/authentication/methods/fido.py +8 -0
  16. office365/directory/authentication/methods/password.py +23 -0
  17. office365/directory/authentication/strength_root.py +5 -0
  18. office365/directory/certificates/auth_configuration.py +1 -3
  19. office365/directory/custom_security_attribute_definition.py +7 -0
  20. office365/directory/device_local_credential_info.py +6 -0
  21. office365/directory/directory.py +40 -12
  22. office365/directory/groups/group.py +2 -6
  23. office365/directory/identities/conditional_access_root.py +10 -1
  24. office365/directory/identities/container.py +3 -9
  25. office365/directory/identities/providers/builtin_identity.py +3 -2
  26. office365/directory/identities/providers/saml_or_wsfed.py +4 -5
  27. office365/directory/identitygovernance/appconsent/request_collection.py +1 -1
  28. office365/directory/identitygovernance/governance.py +14 -3
  29. office365/directory/identitygovernance/privilegedaccess/__init__.py +0 -0
  30. office365/directory/identitygovernance/privilegedaccess/root.py +5 -0
  31. office365/directory/identitygovernance/termsofuse/agreement_acceptance.py +8 -0
  32. office365/directory/identitygovernance/userconsent/request_collection.py +1 -1
  33. office365/directory/insights/resource_reference.py +1 -1
  34. office365/directory/key_credential.py +3 -0
  35. office365/directory/licenses/assignment_state.py +26 -2
  36. office365/directory/licenses/details.py +4 -3
  37. office365/directory/licenses/subscribed_sku.py +8 -10
  38. office365/directory/object_collection.py +40 -25
  39. office365/directory/password_credential.py +3 -0
  40. office365/directory/permissions/default_user_role.py +5 -0
  41. office365/directory/permissions/grants/condition_set.py +4 -2
  42. office365/directory/permissions/grants/oauth2.py +7 -10
  43. office365/directory/policies/authorization.py +50 -3
  44. office365/directory/policies/device_registration.py +6 -0
  45. office365/directory/policies/permission_grant.py +2 -0
  46. office365/directory/policies/root.py +13 -0
  47. office365/directory/profile_photo.py +6 -6
  48. office365/directory/protection/riskyusers/risky_user.py +4 -4
  49. office365/directory/rolemanagement/resource_action.py +10 -0
  50. office365/directory/rolemanagement/role_permission.py +10 -0
  51. office365/directory/security/alerts/alert.py +5 -7
  52. office365/directory/security/attacksimulations/landing_page.py +5 -0
  53. office365/directory/security/attacksimulations/operation.py +5 -0
  54. office365/directory/security/attacksimulations/report.py +8 -1
  55. office365/directory/security/attacksimulations/root.py +33 -0
  56. office365/directory/security/attacksimulations/users/__init__.py +0 -0
  57. office365/directory/security/attacksimulations/users/details.py +5 -0
  58. office365/directory/security/hunting_query_results.py +5 -0
  59. office365/directory/security/incidents/incident.py +8 -13
  60. office365/directory/security/security.py +20 -3
  61. office365/directory/security/threatintelligence/article_indicator.py +7 -0
  62. office365/directory/serviceprincipals/service_principal.py +6 -12
  63. office365/directory/synchronization/schema.py +16 -0
  64. office365/directory/synchronization/synchronization.py +2 -0
  65. office365/directory/users/activities/history_item.py +3 -2
  66. office365/directory/users/user.py +60 -10
  67. office365/entity_collection.py +3 -2
  68. office365/graph_client.py +58 -30
  69. office365/intune/audit/event.py +1 -3
  70. office365/intune/audit/event_collection.py +1 -1
  71. office365/intune/devices/alternative_security_id.py +4 -0
  72. office365/intune/devices/collection.py +57 -0
  73. office365/intune/devices/device.py +38 -10
  74. office365/intune/devices/management/management.py +12 -0
  75. office365/intune/organizations/organization.py +1 -0
  76. office365/onedrive/analytics/item_activity_stat.py +9 -0
  77. office365/onedrive/analytics/item_analytics.py +1 -0
  78. office365/onedrive/contenttypes/content_type.py +4 -12
  79. office365/onedrive/driveitems/driveItem.py +76 -7
  80. office365/onedrive/files/hashes.py +5 -0
  81. office365/onedrive/lists/collection.py +2 -2
  82. office365/onedrive/lists/list.py +1 -1
  83. office365/onedrive/operations/long_running.py +6 -6
  84. office365/onedrive/operations/rich_long_running.py +4 -3
  85. office365/onedrive/permissions/collection.py +1 -14
  86. office365/onedrive/sharepoint_settings.py +6 -6
  87. office365/onedrive/sitepages/__init__.py +0 -0
  88. office365/onedrive/sitepages/base.py +29 -0
  89. office365/onedrive/sitepages/canvas_layout.py +43 -0
  90. office365/onedrive/sitepages/collection.py +32 -0
  91. office365/onedrive/sitepages/horizontal_section.py +23 -0
  92. office365/onedrive/sitepages/horizontal_section_column.py +27 -0
  93. office365/onedrive/sitepages/site_page.py +116 -0
  94. office365/onedrive/sitepages/title_area.py +13 -0
  95. office365/onedrive/sitepages/vertical_section.py +27 -0
  96. office365/onedrive/sitepages/web_part.py +5 -0
  97. office365/onedrive/sites/site.py +10 -0
  98. office365/onedrive/sites/sites_with_root.py +1 -3
  99. office365/onedrive/termstore/store.py +2 -4
  100. office365/onedrive/termstore/terms/collection.py +1 -2
  101. office365/onedrive/workbooks/charts/data_labels.py +13 -1
  102. office365/onedrive/workbooks/filter.py +9 -0
  103. office365/onedrive/workbooks/filter_criteria.py +5 -0
  104. office365/onedrive/workbooks/functions/functions.py +6 -3
  105. office365/onedrive/workbooks/functions/result.py +2 -0
  106. office365/onedrive/workbooks/operations/workbook.py +7 -10
  107. office365/onedrive/workbooks/tables/pivot_table.py +9 -9
  108. office365/onedrive/workbooks/tables/sort.py +5 -0
  109. office365/onedrive/workbooks/tables/table.py +57 -0
  110. office365/onedrive/workbooks/worksheets/collection.py +0 -6
  111. office365/onedrive/workbooks/worksheets/protection.py +22 -1
  112. office365/onedrive/workbooks/worksheets/protection_options.py +7 -0
  113. office365/outlook/calendar/calendar.py +1 -3
  114. office365/outlook/calendar/events/event.py +45 -0
  115. office365/outlook/calendar/permissions/permission.py +7 -7
  116. office365/outlook/calendar/place.py +5 -3
  117. office365/outlook/calendar/response_status.py +11 -0
  118. office365/outlook/calendar/rooms/room.py +14 -0
  119. office365/outlook/mail/attachments/collection.py +6 -1
  120. office365/outlook/mail/automatic_replies_mailtips.py +5 -0
  121. office365/outlook/mail/conversation.py +1 -3
  122. office365/outlook/mail/folders/folder.py +1 -3
  123. office365/outlook/mail/messages/message.py +1 -1
  124. office365/outlook/mail/tips.py +17 -0
  125. office365/planner/plans/plan.py +11 -1
  126. office365/reports/root.py +83 -4
  127. office365/runtime/auth/authentication_context.py +12 -2
  128. office365/runtime/auth/providers/acs_token_provider.py +10 -7
  129. office365/runtime/auth/sts_profile.py +0 -1
  130. office365/runtime/client_object.py +18 -14
  131. office365/runtime/client_object_collection.py +8 -23
  132. office365/runtime/client_request_exception.py +1 -3
  133. office365/runtime/client_result.py +11 -14
  134. office365/runtime/client_runtime_context.py +11 -21
  135. office365/runtime/odata/json_format.py +7 -9
  136. office365/runtime/odata/request.py +12 -2
  137. office365/runtime/odata/v3/batch_request.py +7 -15
  138. office365/runtime/odata/v4/batch_request.py +13 -21
  139. office365/runtime/queries/upload_session.py +5 -0
  140. office365/runtime/types/event_handler.py +1 -1
  141. office365/search/entity.py +3 -2
  142. office365/sharepoint/activities/facets/delete.py +1 -1
  143. office365/sharepoint/activities/tracked_item_service.py +2 -3
  144. office365/sharepoint/administration/web_application.py +8 -7
  145. office365/sharepoint/alerts/collection.py +2 -1
  146. office365/sharepoint/attachments/attachment.py +3 -9
  147. office365/sharepoint/audit/audit.py +3 -2
  148. office365/sharepoint/changes/alert.py +4 -3
  149. office365/sharepoint/changes/collection.py +7 -10
  150. office365/sharepoint/changes/content_type.py +4 -4
  151. office365/sharepoint/changes/field.py +4 -5
  152. office365/sharepoint/changes/item.py +34 -7
  153. office365/sharepoint/changes/list.py +4 -4
  154. office365/sharepoint/changes/user.py +5 -6
  155. office365/sharepoint/client_context.py +4 -2
  156. office365/sharepoint/clientsidecomponent/component_context_info.py +4 -3
  157. office365/sharepoint/contentcenter/machinelearning/enabled.py +4 -3
  158. office365/sharepoint/contentcenter/machinelearning/hub.py +6 -6
  159. office365/sharepoint/contentcenter/machinelearning/models/collection.py +1 -1
  160. office365/sharepoint/contenttypes/content_type.py +13 -1
  161. office365/sharepoint/contenttypes/fieldlinks/collection.py +5 -7
  162. office365/sharepoint/contenttypes/fieldlinks/field_link.py +14 -22
  163. office365/sharepoint/directory/helper.py +2 -0
  164. office365/sharepoint/entity.py +12 -5
  165. office365/sharepoint/entity_collection.py +1 -3
  166. office365/sharepoint/eventreceivers/definition.py +8 -12
  167. office365/sharepoint/features/collection.py +1 -2
  168. office365/sharepoint/features/definitions/definition.py +6 -3
  169. office365/sharepoint/fields/calculated.py +8 -14
  170. office365/sharepoint/fields/collection.py +46 -13
  171. office365/sharepoint/fields/computed.py +4 -5
  172. office365/sharepoint/fields/currency.py +7 -11
  173. office365/sharepoint/fields/date_time.py +4 -8
  174. office365/sharepoint/fields/field.py +6 -16
  175. office365/sharepoint/fields/lookup.py +11 -9
  176. office365/sharepoint/fields/multi_choice.py +8 -12
  177. office365/sharepoint/fields/multi_line_text.py +10 -14
  178. office365/sharepoint/fields/number.py +13 -26
  179. office365/sharepoint/fields/rating_scale.py +6 -10
  180. office365/sharepoint/fields/related_field.py +10 -17
  181. office365/sharepoint/fields/url.py +4 -5
  182. office365/sharepoint/fields/user.py +10 -9
  183. office365/sharepoint/files/collection.py +17 -15
  184. office365/sharepoint/files/file.py +30 -23
  185. office365/sharepoint/folders/collection.py +22 -5
  186. office365/sharepoint/folders/coloring.py +11 -9
  187. office365/sharepoint/folders/coloring_information.py +38 -0
  188. office365/sharepoint/folders/folder.py +23 -25
  189. office365/sharepoint/likes/liked_by_information.py +7 -10
  190. office365/sharepoint/likes/user_entity.py +6 -8
  191. office365/sharepoint/listitems/form_update_value.py +17 -1
  192. office365/sharepoint/listitems/listitem.py +2 -2
  193. office365/sharepoint/lists/bloom_filter.py +5 -7
  194. office365/sharepoint/lists/creatables_info.py +5 -6
  195. office365/sharepoint/lists/list.py +24 -9
  196. office365/sharepoint/lists/template.py +7 -4
  197. office365/sharepoint/lists/template_collection.py +2 -4
  198. office365/sharepoint/marketplace/app_metadata.py +14 -23
  199. office365/sharepoint/marketplace/sitecollection/appcatalog/allowed_item.py +6 -8
  200. office365/sharepoint/migrationcenter/deploy_status.py +5 -0
  201. office365/sharepoint/migrationcenter/service/performance/__init__.py +0 -0
  202. office365/sharepoint/migrationcenter/service/performance/dashboard_data.py +9 -0
  203. office365/sharepoint/migrationcenter/service/performance/data.py +7 -0
  204. office365/sharepoint/migrationcenter/service/performance/entity_data.py +5 -0
  205. office365/sharepoint/navigation/node.py +5 -8
  206. office365/sharepoint/permissions/irm/effective_settings.py +6 -8
  207. office365/sharepoint/permissions/irm/file_settings.py +8 -6
  208. office365/sharepoint/permissions/irm/settings.py +25 -43
  209. office365/sharepoint/portal/groups/site_manager.py +6 -7
  210. office365/sharepoint/principal/principal.py +2 -4
  211. office365/sharepoint/publishing/embed_data_v1.py +8 -15
  212. office365/sharepoint/publishing/pages/campaign_publication.py +4 -3
  213. office365/sharepoint/publishing/primary_city_time.py +8 -9
  214. office365/sharepoint/publishing/video/service_discoverer.py +4 -3
  215. office365/sharepoint/pushnotifications/subscriber.py +11 -15
  216. office365/sharepoint/recyclebin/item.py +107 -7
  217. office365/sharepoint/sharing/information.py +9 -0
  218. office365/sharepoint/sharing/link_info.py +6 -0
  219. office365/sharepoint/sharing/object_sharing_settings.py +24 -46
  220. office365/sharepoint/sharing/permission_collection.py +18 -0
  221. office365/sharepoint/sharing/permission_information.py +5 -5
  222. office365/sharepoint/sharing/result.py +1 -0
  223. office365/sharepoint/sitedesigns/run.py +4 -3
  224. office365/sharepoint/sites/script_safe_domain.py +5 -0
  225. office365/sharepoint/sites/site.py +17 -20
  226. office365/sharepoint/taxonomy/field.py +32 -21
  227. office365/sharepoint/taxonomy/field_value.py +1 -1
  228. office365/sharepoint/taxonomy/groups/group.py +12 -1
  229. office365/sharepoint/taxonomy/sets/set.py +6 -0
  230. office365/sharepoint/taxonomy/stores/store.py +4 -2
  231. office365/sharepoint/teams/channel.py +6 -6
  232. office365/sharepoint/tenant/administration/endpoints.py +4 -3
  233. office365/sharepoint/tenant/administration/hubsites/properties.py +4 -5
  234. office365/sharepoint/tenant/administration/powerapps/__init__.py +0 -0
  235. office365/sharepoint/tenant/administration/powerapps/environment_context.py +8 -0
  236. office365/sharepoint/tenant/administration/sites/properties.py +0 -1
  237. office365/sharepoint/tenant/administration/spo_operation.py +4 -4
  238. office365/sharepoint/tenant/administration/tenant.py +1 -0
  239. office365/sharepoint/tenant/insights/report.py +11 -0
  240. office365/sharepoint/tenant/insights/report_manager.py +5 -0
  241. office365/sharepoint/tenant/insights/report_metadata.py +5 -0
  242. office365/sharepoint/tenant/settings.py +4 -3
  243. office365/sharepoint/translation/sync_translator.py +3 -2
  244. office365/sharepoint/ui/applicationpages/peoplepicker/entity_information.py +4 -4
  245. office365/sharepoint/usercustomactions/action.py +12 -20
  246. office365/sharepoint/userprofiles/followed_content.py +6 -10
  247. office365/sharepoint/userprofiles/people_manager.py +0 -1
  248. office365/sharepoint/userprofiles/person_properties.py +14 -30
  249. office365/sharepoint/userprofiles/personal_cache.py +4 -3
  250. office365/sharepoint/userprofiles/properties_for_user.py +4 -5
  251. office365/sharepoint/userprofiles/sharedwithme/document.py +12 -21
  252. office365/sharepoint/utilities/move_copy_util.py +19 -19
  253. office365/sharepoint/utilities/upload_status.py +7 -10
  254. office365/sharepoint/views/field_collection.py +9 -14
  255. office365/sharepoint/views/view.py +43 -64
  256. office365/sharepoint/webhooks/subscription.py +11 -19
  257. office365/sharepoint/webparts/webpart.py +3 -1
  258. office365/sharepoint/webs/information_collection.py +1 -1
  259. office365/sharepoint/webs/modernize_homepage_result.py +4 -3
  260. office365/sharepoint/webs/regional_settings.py +79 -16
  261. office365/sharepoint/webs/template.py +3 -5
  262. office365/sharepoint/webs/web.py +24 -25
  263. office365/teams/apps/catalog.py +1 -0
  264. office365/teams/chats/chat.py +4 -0
  265. office365/teams/operations/async_operation.py +5 -7
  266. office365/teams/schedule/schedule.py +6 -2
  267. office365/runtime/paths/item.py +0 -8
  268. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/LICENSE +0 -0
  269. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/WHEEL +0 -0
  270. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.7.dist-info}/top_level.txt +0 -0
@@ -104,17 +104,15 @@ class ServicePrincipal(DirectoryObject):
104
104
  def grant(self, app, app_role):
105
105
  # type: (Application|str, AppRole|str) -> Self
106
106
  """
107
- Revokes an app role assignment to a client service principal
107
+ Grants an app role assignment to a client service principal
108
108
  :param Application or str app: Application object or app identifier
109
109
  :param AppRole or str app_role: AppRole object or name
110
110
  """
111
111
 
112
112
  def _grant(principal):
113
113
  # type: ("ServicePrincipal") -> None
114
- app_role_id = repr(app_role)
115
- principal_id = principal.id
116
114
  self.app_role_assigned_to.add(
117
- principalId=principal_id, resourceId=self.id, appRoleId=app_role_id
115
+ principalId=principal.id, resourceId=self.id, appRoleId=app_role.id
118
116
  )
119
117
 
120
118
  def _ensure_principal():
@@ -128,20 +126,17 @@ class ServicePrincipal(DirectoryObject):
128
126
  """Revokes an app role assignment from a client service principal"""
129
127
 
130
128
  def _revoke(principal):
131
- # type ("ServicePrincipal") -> None
132
- principal_id = principal.id
133
- app_role_id = repr(app_role)
129
+ # type: ("ServicePrincipal") -> None
134
130
  app_role_assigned_to_ids = [
135
131
  item.id
136
132
  for item in self.app_role_assigned_to
137
- if item.principal_id == principal_id and item.app_role_id == app_role_id
133
+ if item.principal_id == principal.id and item.app_role_id == app_role.id
138
134
  ]
139
135
  if len(app_role_assigned_to_ids) > 0:
140
136
  self.app_role_assigned_to[app_role_assigned_to_ids[0]].delete_object()
141
137
 
142
138
  def _ensure_resource(principal):
143
139
  self.ensure_properties(["id", "appRoleAssignedTo"], _revoke, principal)
144
- # self.app_role_assigned_to.get_all(page_loaded=_revoke)
145
140
 
146
141
  def _ensure_principal():
147
142
  self.context.service_principals.get_by_app(app).get().after_execute(
@@ -205,9 +200,7 @@ class ServicePrincipal(DirectoryObject):
205
200
 
206
201
  @property
207
202
  def app_roles(self):
208
- """
209
- The roles exposed by the application which this service principal represents.
210
- """
203
+ """The roles exposed by the application which this service principal represents."""
211
204
  return self.properties.get("appRoles", AppRoleCollection())
212
205
 
213
206
  @property
@@ -299,6 +292,7 @@ class ServicePrincipal(DirectoryObject):
299
292
 
300
293
  @property
301
294
  def oauth2_permission_scopes(self):
295
+ # type: () -> ClientValueCollection[PermissionScope]
302
296
  """
303
297
  The delegated permissions exposed by the application. For more information see the oauth2PermissionScopes
304
298
  property on the application entity's api property.
@@ -1,4 +1,7 @@
1
+ from office365.directory.synchronization.directory_definition import DirectoryDefinition
1
2
  from office365.entity import Entity
3
+ from office365.entity_collection import EntityCollection
4
+ from office365.runtime.paths.resource_path import ResourcePath
2
5
 
3
6
 
4
7
  class SynchronizationSchema(Entity):
@@ -9,3 +12,16 @@ class SynchronizationSchema(Entity):
9
12
 
10
13
  The following sections describe the high-level components of the synchronization schema.
11
14
  """
15
+
16
+ @property
17
+ def directories(self):
18
+ # type: () -> EntityCollection[DirectoryDefinition]
19
+ """Contains the collection of directories and all of their objects."""
20
+ return self.properties.get(
21
+ "directories",
22
+ EntityCollection(
23
+ self.context,
24
+ DirectoryDefinition,
25
+ ResourcePath("directories", self.resource_path),
26
+ ),
27
+ )
@@ -16,6 +16,7 @@ class Synchronization(Entity):
16
16
 
17
17
  @property
18
18
  def jobs(self):
19
+ # type: () -> EntityCollection[SynchronizationJob]
19
20
  """
20
21
  Performs synchronization by periodically running in the background, polling for changes in one directory,
21
22
  and pushing them to another directory.
@@ -31,6 +32,7 @@ class Synchronization(Entity):
31
32
 
32
33
  @property
33
34
  def templates(self):
35
+ # type: () -> EntityCollection[SynchronizationTemplate]
34
36
  """
35
37
  Performs synchronization by periodically running in the background, polling for changes in one directory,
36
38
  and pushing them to another directory.
@@ -1,4 +1,5 @@
1
1
  import datetime
2
+ from typing import Optional
2
3
 
3
4
  from office365.directory.users.activities.activity import UserActivity
4
5
  from office365.entity import Entity
@@ -16,10 +17,10 @@ class ActivityHistoryItem(Entity):
16
17
 
17
18
  @property
18
19
  def active_duration_seconds(self):
20
+ # type: () -> Optional[int]
19
21
  """
20
- Optional. The duration of active user engagement. if not supplied, this is calculated from the startedDateTime
22
+ The duration of active user engagement. if not supplied, this is calculated from the startedDateTime
21
23
  and lastActiveDateTime.
22
- :rtype: int or None
23
24
  """
24
25
  return self.properties.get("activeDurationSeconds", None)
25
26
 
@@ -1,4 +1,5 @@
1
1
  import json
2
+ from datetime import datetime
2
3
  from typing import Optional
3
4
 
4
5
  from office365.communications.onlinemeetings.collection import OnlineMeetingCollection
@@ -49,6 +50,7 @@ from office365.outlook.mail.mailbox_settings import MailboxSettings
49
50
  from office365.outlook.mail.messages.collection import MessageCollection
50
51
  from office365.outlook.mail.messages.message import Message
51
52
  from office365.outlook.mail.recipient import Recipient
53
+ from office365.outlook.mail.tips import MailTips
52
54
  from office365.outlook.user import OutlookUser
53
55
  from office365.planner.user import PlannerUser
54
56
  from office365.runtime.client_result import ClientResult
@@ -168,6 +170,28 @@ class User(DirectoryObject):
168
170
  self.context.add_query(qry)
169
171
  return self
170
172
 
173
+ def get_mail_tips(self, email_addresses, mail_tips_options=None):
174
+ """Get the MailTips of one or more recipients as available to the signed-in user.
175
+ :param list[str] email_addresses: A collection of SMTP addresses of recipients to get MailTips for.
176
+ :param str mail_tips_options: A enumeration of flags that represents the requested mailtips.
177
+ Possible values are: automaticReplies, customMailTip, deliveryRestriction, externalMemberCount,
178
+ mailboxFullStatus, maxMessageSize, moderationStatus, recipientScope, recipientSuggestions,
179
+ and totalMemberCount.
180
+ """
181
+ return_type = ClientResult(self.context, ClientValueCollection(MailTips))
182
+ payload = {
183
+ "EmailAddresses": StringCollection(email_addresses),
184
+ "MailTipsOptions": mail_tips_options,
185
+ }
186
+ qry = ServiceOperationQuery(
187
+ self,
188
+ "getMailTips",
189
+ None,
190
+ payload,
191
+ )
192
+ self.context.add_query(qry)
193
+ return return_type
194
+
171
195
  def send_mail(
172
196
  self,
173
197
  subject,
@@ -445,9 +469,29 @@ class User(DirectoryObject):
445
469
  self.context.add_query(qry)
446
470
  return return_type
447
471
 
472
+ @property
473
+ def created_datetime(self):
474
+ # type: () -> Optional[datetime]
475
+ """
476
+ The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time.
477
+ For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z
478
+ """
479
+ return self.properties.get("createdDateTime", datetime.min)
480
+
481
+ @property
482
+ def created_objects(self):
483
+ """Directory objects created by this user."""
484
+ return self.properties.get(
485
+ "createdObjects",
486
+ DirectoryObjectCollection(
487
+ self.context, ResourcePath("createdObjects", self.resource_path)
488
+ ),
489
+ )
490
+
448
491
  @property
449
492
  def device_enrollment_limit(self):
450
493
  # type: () -> Optional[str]
494
+ """ """
451
495
  return self.properties.get("deviceEnrollmentLimit", None)
452
496
 
453
497
  @property
@@ -630,6 +674,16 @@ class User(DirectoryObject):
630
674
  ProfilePhoto(self.context, ResourcePath("photo", self.resource_path)),
631
675
  )
632
676
 
677
+ @property
678
+ def photos(self):
679
+ """The collection of the user's profile photos in different sizes"""
680
+ return self.properties.get(
681
+ "photos",
682
+ EntityCollection(
683
+ self.context, ProfilePhoto, ResourcePath("photos", self.resource_path)
684
+ ),
685
+ )
686
+
633
687
  @property
634
688
  def manager(self):
635
689
  """The user or contact that is this user's manager"""
@@ -770,7 +824,7 @@ class User(DirectoryObject):
770
824
  @property
771
825
  def managed_devices(self):
772
826
  # type: () -> EntityCollection[ManagedDevice]
773
- """"""
827
+ """Devices that are managed or pre-enrolled through Intune"""
774
828
  return self.properties.get(
775
829
  "managedDevices",
776
830
  EntityCollection(
@@ -936,9 +990,7 @@ class User(DirectoryObject):
936
990
 
937
991
  @property
938
992
  def online_meetings(self):
939
- """
940
- Get a user's online meetings.
941
- """
993
+ """Get a user's online meetings."""
942
994
  return self.properties.get(
943
995
  "onlineMeetings",
944
996
  OnlineMeetingCollection(
@@ -987,21 +1039,18 @@ class User(DirectoryObject):
987
1039
  @property
988
1040
  def street_address(self):
989
1041
  # type: () -> Optional[str]
990
- """
991
- The street address of the user's place of business. Maximum length is 1024 characters.
992
- """
1042
+ """The street address of the user's place of business. Maximum length is 1024 characters."""
993
1043
  return self.properties.get("streetAddress", None)
994
1044
 
995
1045
  @property
996
1046
  def security_identifier(self):
997
1047
  # type: () -> Optional[str]
998
- """
999
- Security identifier (SID) of the user, used in Windows scenarios.
1000
- """
1048
+ """Security identifier (SID) of the user, used in Windows scenarios."""
1001
1049
  return self.properties.get("securityIdentifier", None)
1002
1050
 
1003
1051
  @property
1004
1052
  def teamwork(self):
1053
+ # type: () -> UserTeamwork
1005
1054
  """A container for the range of Microsoft Teams functionalities that are available per user in the tenant."""
1006
1055
  return self.properties.get(
1007
1056
  "teamwork",
@@ -1042,6 +1091,7 @@ class User(DirectoryObject):
1042
1091
  "businessPhones": self.business_phones,
1043
1092
  "calendarGroups": self.calendar_groups,
1044
1093
  "contactFolders": self.contact_folders,
1094
+ "createdObjects": self.created_objects,
1045
1095
  "employeeExperience": self.employee_experience,
1046
1096
  "followedSites": self.followed_sites,
1047
1097
  "licenseDetails": self.license_details,
@@ -3,7 +3,6 @@ from typing import TYPE_CHECKING, Any, Optional, Type, TypeVar
3
3
  from office365.entity import Entity
4
4
  from office365.runtime.client_object_collection import ClientObjectCollection
5
5
  from office365.runtime.compat import is_string_type
6
- from office365.runtime.paths.item import ItemPath
7
6
  from office365.runtime.paths.resource_path import ResourcePath
8
7
  from office365.runtime.paths.v4.entity import EntityPath
9
8
  from office365.runtime.queries.create_entity import CreateEntityQuery
@@ -43,7 +42,9 @@ class EntityCollection(ClientObjectCollection[T]):
43
42
  def add(self, **kwargs):
44
43
  # type: (Any) -> T
45
44
  """Creates an entity and prepares the query"""
46
- return_type = self.create_typed_object(kwargs, ItemPath(self.resource_path))
45
+ return_type = self.create_typed_object(
46
+ kwargs, EntityPath(None, self.resource_path)
47
+ )
47
48
  self.add_child(return_type)
48
49
  qry = CreateEntityQuery(self, return_type, return_type)
49
50
  self.context.add_query(qry)
office365/graph_client.py CHANGED
@@ -6,6 +6,12 @@ from office365.delta_collection import DeltaCollection
6
6
  from office365.directory.applications.collection import ApplicationCollection
7
7
  from office365.directory.applications.template import ApplicationTemplate
8
8
  from office365.directory.audit.log_root import AuditLogRoot
9
+ from office365.directory.authentication.method_configuration import (
10
+ AuthenticationMethodConfiguration,
11
+ )
12
+ from office365.directory.certificates.auth_configuration import (
13
+ CertificateBasedAuthConfiguration,
14
+ )
9
15
  from office365.directory.directory import Directory
10
16
  from office365.directory.domains.domain import Domain
11
17
  from office365.directory.extensions.schema import SchemaExtension
@@ -35,6 +41,7 @@ from office365.directory.users.user import User
35
41
  from office365.education.root import EducationRoot
36
42
  from office365.entity_collection import EntityCollection
37
43
  from office365.intune.devices.app_management import DeviceAppManagement
44
+ from office365.intune.devices.collection import DeviceCollection
38
45
  from office365.intune.devices.management.management import DeviceManagement
39
46
  from office365.intune.organizations.contact import OrgContact
40
47
  from office365.intune.organizations.organization import Organization
@@ -65,19 +72,31 @@ from office365.teams.collection import TeamCollection
65
72
  from office365.teams.template import TeamsTemplate
66
73
  from office365.teams.viva.employee_experience import EmployeeExperience
67
74
 
75
+ environments_endpoints = {
76
+ "GCCH": {
77
+ "graph_url": "https://graph.microsoft.com",
78
+ "entra_url": "https://login.microsoftonline.com",
79
+ },
80
+ "GCC High": {
81
+ "graph_url": "https://graph.microsoft.us",
82
+ "entra_url": "https://login.microsoftonline.us",
83
+ },
84
+ "DoD": {
85
+ "graph_url": "https://dod-graph.microsoft.us",
86
+ "entra_url": "https://login.chinacloudapi.cn",
87
+ },
88
+ }
89
+
68
90
 
69
91
  class GraphClient(ClientRuntimeContext):
70
92
  """Graph Service client"""
71
93
 
72
- def __init__(self, acquire_token_callback):
73
- # type: (Callable[[], dict]) -> None
74
- """
75
- :param () -> dict acquire_token_callback: Acquire token function
76
- """
94
+ def __init__(self, acquire_token_callback, version="v1.0", environment="GCCH"):
95
+ # type: (Callable[[], dict], str, str) -> None
77
96
  super(GraphClient, self).__init__()
78
97
  self._pending_request = None
79
- self._resource = "https://graph.microsoft.com"
80
- self._authority_host_url = "https://login.microsoftonline.com"
98
+ self._version = version
99
+ self._environment_endpoints = environments_endpoints.get(environment, None)
81
100
  self._acquire_token_callback = acquire_token_callback
82
101
 
83
102
  @staticmethod
@@ -130,7 +149,7 @@ class GraphClient(ClientRuntimeContext):
130
149
  :param str client_secret: Client secret
131
150
  :param list[str] or None scopes: Scopes requested to access an API
132
151
  :param Any token_cache: Default cache is in memory only,
133
- Refer https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache
152
+ Refer https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache
134
153
  """
135
154
  if scopes is None:
136
155
  scopes = ["https://graph.microsoft.com/.default"]
@@ -248,7 +267,7 @@ class GraphClient(ClientRuntimeContext):
248
267
 
249
268
  def service_root_url(self):
250
269
  # type: () -> str
251
- return "https://graph.microsoft.com/v1.0"
270
+ return "https://graph.microsoft.com/{0}".format(self._version)
252
271
 
253
272
  def _build_specific_query(self, request):
254
273
  # type: (RequestOptions) -> None
@@ -334,6 +353,11 @@ class GraphClient(ClientRuntimeContext):
334
353
  """Directory Objects container"""
335
354
  return DirectoryObjectCollection(self, ResourcePath("directoryObjects"))
336
355
 
356
+ @property
357
+ def devices(self):
358
+ """Devices container"""
359
+ return DeviceCollection(self, ResourcePath("devices"))
360
+
337
361
  @property
338
362
  def teams(self):
339
363
  """Teams container"""
@@ -393,11 +417,29 @@ class GraphClient(ClientRuntimeContext):
393
417
  self, ApplicationTemplate, ResourcePath("applicationTemplates")
394
418
  )
395
419
 
420
+ @property
421
+ def authentication_method_configurations(self):
422
+ """Get the list of application templates in this organization."""
423
+ return EntityCollection(
424
+ self,
425
+ AuthenticationMethodConfiguration,
426
+ ResourcePath("authenticationMethodConfigurations"),
427
+ )
428
+
396
429
  @property
397
430
  def applications(self):
398
431
  """Get the list of applications in this organization."""
399
432
  return ApplicationCollection(self, ResourcePath("applications"))
400
433
 
434
+ @property
435
+ def certificate_based_auth_configuration(self):
436
+ """Get the list of applications in this organization."""
437
+ return EntityCollection(
438
+ self,
439
+ CertificateBasedAuthConfiguration,
440
+ ResourcePath("certificateBasedAuthConfiguration"),
441
+ )
442
+
401
443
  @property
402
444
  def service_principals(self):
403
445
  """Retrieve a list of servicePrincipal objects."""
@@ -429,16 +471,12 @@ class GraphClient(ClientRuntimeContext):
429
471
 
430
472
  @property
431
473
  def communications(self):
432
- """
433
- Cloud communications API endpoint
434
- """
474
+ """Cloud communications API endpoint"""
435
475
  return CloudCommunications(self, ResourcePath("communications"))
436
476
 
437
477
  @property
438
478
  def identity_governance(self):
439
- """
440
- The identity governance singleton
441
- """
479
+ """The identity governance singleton"""
442
480
  return IdentityGovernance(self, ResourcePath("identityGovernance"))
443
481
 
444
482
  @property
@@ -503,9 +541,7 @@ class GraphClient(ClientRuntimeContext):
503
541
 
504
542
  @property
505
543
  def teams_templates(self):
506
- """
507
- Get the list of teams templates.
508
- """
544
+ """Get the list of teams templates."""
509
545
  return EntityCollection(self, TeamsTemplate, ResourcePath("teamsTemplates"))
510
546
 
511
547
  @property
@@ -518,34 +554,26 @@ class GraphClient(ClientRuntimeContext):
518
554
 
519
555
  @property
520
556
  def permission_grants(self):
521
- """
522
- List all resource-specific permission grants
523
- """
557
+ """List all resource-specific permission grants"""
524
558
  return EntityCollection(
525
559
  self, ResourceSpecificPermissionGrant, ResourcePath("permissionGrants")
526
560
  )
527
561
 
528
562
  @property
529
563
  def print(self):
530
- """
531
- Used to manage printers and print jobs within Universal Print.
532
- """
564
+ """Used to manage printers and print jobs within Universal Print."""
533
565
  from office365.intune.printing.print import Print
534
566
 
535
567
  return Print(self, ResourcePath("print"))
536
568
 
537
569
  @property
538
570
  def search(self):
539
- """
540
- The search endpoint is the entry point for Microsoft Search API to query data.
541
- """
571
+ """The search endpoint is the entry point for Microsoft Search API to query data."""
542
572
  return SearchEntity(self, ResourcePath("search"))
543
573
 
544
574
  @property
545
575
  def employee_experience(self):
546
- """
547
- An alias to EmployeeExperience
548
- """
576
+ """An alias to EmployeeExperience"""
549
577
  return EmployeeExperience(self, ResourcePath("employeeExperience"))
550
578
 
551
579
  @property
@@ -17,9 +17,7 @@ class AuditEvent(Entity):
17
17
 
18
18
  @property
19
19
  def actor(self):
20
- """
21
- AAD user and application that are associated with the audit event.
22
- """
20
+ """AAD user and application that are associated with the audit event."""
23
21
  return self.properties.get("actor", AuditActor())
24
22
 
25
23
  @property
@@ -5,7 +5,7 @@ from office365.runtime.queries.function import FunctionQuery
5
5
  from office365.runtime.types.collections import StringCollection
6
6
 
7
7
 
8
- class AuditEventCollection(EntityCollection):
8
+ class AuditEventCollection(EntityCollection[AuditEvent]):
9
9
  def __init__(self, context, resource_path=None):
10
10
  super(AuditEventCollection, self).__init__(context, AuditEvent, resource_path)
11
11
 
@@ -3,3 +3,7 @@ from office365.runtime.client_value import ClientValue
3
3
 
4
4
  class AlternativeSecurityId(ClientValue):
5
5
  """"""
6
+
7
+ def __init__(self, type_=None, key=None):
8
+ self.type = type_
9
+ self.key = key
@@ -0,0 +1,57 @@
1
+ import random
2
+ import string
3
+ import uuid
4
+
5
+ from office365.delta_collection import DeltaCollection
6
+ from office365.intune.devices.alternative_security_id import AlternativeSecurityId
7
+ from office365.intune.devices.device import Device
8
+ from office365.runtime.client_value_collection import ClientValueCollection
9
+ from office365.runtime.queries.create_entity import CreateEntityQuery
10
+
11
+
12
+ class DeviceCollection(DeltaCollection[Device]):
13
+ """Device's collection"""
14
+
15
+ def __init__(self, context, resource_path=None):
16
+ super(DeviceCollection, self).__init__(context, Device, resource_path)
17
+
18
+ def add(
19
+ self,
20
+ display_name,
21
+ operating_system,
22
+ operating_system_version,
23
+ account_enabled=False,
24
+ alternative_security_id=None,
25
+ device_id=None,
26
+ ):
27
+ """Create and register a new device in the organization.
28
+ :param str display_name: The display name for the device
29
+ :param str operating_system:
30
+ :param str operating_system_version:
31
+ :param bool account_enabled:
32
+ :param AlternativeSecurityId alternative_security_id:
33
+ :param str device_id:
34
+ """
35
+
36
+ if alternative_security_id is None:
37
+ key_id = "base64" + "".join(
38
+ random.choice(string.ascii_lowercase + string.digits) for _ in range(10)
39
+ )
40
+ alternative_security_id = AlternativeSecurityId(2, key_id)
41
+ if device_id is None:
42
+ device_id = str(uuid.uuid4())
43
+
44
+ return_type = Device(self.context)
45
+ return_type.set_property("displayName", display_name)
46
+ return_type.set_property("operatingSystem", operating_system)
47
+ return_type.set_property("operatingSystemVersion", operating_system_version)
48
+ return_type.set_property("accountEnabled", account_enabled)
49
+ return_type.set_property("deviceId", device_id)
50
+ return_type.set_property(
51
+ "alternativeSecurityIds",
52
+ ClientValueCollection(AlternativeSecurityId, [alternative_security_id]),
53
+ )
54
+ self.add_child(return_type)
55
+ qry = CreateEntityQuery(self, return_type, return_type)
56
+ self.context.add_query(qry)
57
+ return return_type
@@ -1,5 +1,9 @@
1
+ from typing import Optional
2
+
1
3
  from office365.directory.object import DirectoryObject
2
4
  from office365.directory.object_collection import DirectoryObjectCollection
5
+ from office365.intune.devices.alternative_security_id import AlternativeSecurityId
6
+ from office365.runtime.client_value_collection import ClientValueCollection
3
7
  from office365.runtime.paths.resource_path import ResourcePath
4
8
 
5
9
 
@@ -10,16 +14,28 @@ class Device(DirectoryObject):
10
14
  authentication. These devices can range from desktop and laptop machines to phones and tablets.
11
15
  """
12
16
 
13
- def get_property(self, name, default_value=None):
14
- if default_value is None:
15
- property_mapping = {
16
- "memberOf": self.member_of,
17
- "registeredOwners": self.registered_owners,
18
- "registeredUsers": self.registered_users,
19
- "transitiveMemberOf": self.transitive_member_of,
20
- }
21
- default_value = property_mapping.get(name, None)
22
- return super(Device, self).get_property(name, default_value)
17
+ def __repr__(self):
18
+ return self.device_id or self.entity_type_name
19
+
20
+ @property
21
+ def alternative_security_ids(self):
22
+ """For internal use only."""
23
+ return self.properties.get(
24
+ "alternativeSecurityIds", ClientValueCollection(AlternativeSecurityId)
25
+ )
26
+
27
+ @property
28
+ def device_id(self):
29
+ # type: () -> Optional[str]
30
+ """Unique identifier set by Azure Device Registration Service at the time of registration.
31
+ This is an alternate key that can be used to reference the device object."""
32
+ return self.properties.get("deviceId", None)
33
+
34
+ @property
35
+ def device_ownership(self):
36
+ # type: () -> Optional[str]
37
+ """Ownership of the device. This property is set by Intune. Possible values are: unknown, company, personal."""
38
+ return self.properties.get("deviceOwnership", None)
23
39
 
24
40
  @property
25
41
  def member_of(self):
@@ -65,3 +81,15 @@ class Device(DirectoryObject):
65
81
  self.context, ResourcePath("transitiveMemberOf", self.resource_path)
66
82
  ),
67
83
  )
84
+
85
+ def get_property(self, name, default_value=None):
86
+ if default_value is None:
87
+ property_mapping = {
88
+ "alternativeSecurityIds": self.alternative_security_ids,
89
+ "memberOf": self.member_of,
90
+ "registeredOwners": self.registered_owners,
91
+ "registeredUsers": self.registered_users,
92
+ "transitiveMemberOf": self.transitive_member_of,
93
+ }
94
+ default_value = property_mapping.get(name, None)
95
+ return super(Device, self).get_property(name, default_value)
@@ -1,3 +1,4 @@
1
+ from office365.directory.rolemanagement.role_permission import RolePermission
1
2
  from office365.entity import Entity
2
3
  from office365.entity_collection import EntityCollection
3
4
  from office365.intune.audit.event_collection import AuditEventCollection
@@ -8,7 +9,10 @@ from office365.intune.devices.enrollment.configuration import (
8
9
  )
9
10
  from office365.intune.devices.managed import ManagedDevice
10
11
  from office365.intune.devices.management.reports.reports import DeviceManagementReports
12
+ from office365.runtime.client_result import ClientResult
13
+ from office365.runtime.client_value_collection import ClientValueCollection
11
14
  from office365.runtime.paths.resource_path import ResourcePath
15
+ from office365.runtime.queries.function import FunctionQuery
12
16
 
13
17
 
14
18
  class DeviceManagement(Entity):
@@ -18,6 +22,14 @@ class DeviceManagement(Entity):
18
22
  configuration.
19
23
  """
20
24
 
25
+ def get_effective_permissions(self, scope=None):
26
+ """Retrieves the effective permissions of the currently authenticated user"""
27
+ return_type = ClientResult(self.context, ClientValueCollection(RolePermission))
28
+ # params = {"scope": scope}
29
+ qry = FunctionQuery(self, "getEffectivePermissions", None, return_type)
30
+ self.context.add_query(qry)
31
+ return return_type
32
+
21
33
  @property
22
34
  def audit_events(self):
23
35
  """"""
@@ -43,6 +43,7 @@ class Organization(DirectoryObject):
43
43
 
44
44
  @property
45
45
  def extensions(self):
46
+ # type: () -> EntityCollection[Extension]
46
47
  """The collection of open extensions defined for the message. Nullable."""
47
48
  return self.properties.get(
48
49
  "extensions",