Office365-REST-Python-Client 2.5.5__py3-none-any.whl → 2.5.6__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 (203) hide show
  1. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/METADATA +2 -2
  2. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/RECORD +202 -182
  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/applications/application.py +3 -3
  7. office365/directory/applications/roles/assignment_collection.py +1 -1
  8. office365/directory/applications/roles/collection.py +2 -2
  9. office365/directory/authentication/method_configuration.py +9 -0
  10. office365/directory/authentication/method_mode_detail.py +8 -0
  11. office365/directory/authentication/method_target.py +5 -0
  12. office365/directory/authentication/strength_root.py +5 -0
  13. office365/directory/certificates/auth_configuration.py +1 -3
  14. office365/directory/groups/group.py +2 -6
  15. office365/directory/identities/conditional_access_root.py +10 -1
  16. office365/directory/identities/container.py +3 -9
  17. office365/directory/identities/providers/builtin_identity.py +3 -2
  18. office365/directory/identities/providers/saml_or_wsfed.py +4 -5
  19. office365/directory/identitygovernance/governance.py +14 -3
  20. office365/directory/identitygovernance/privilegedaccess/__init__.py +0 -0
  21. office365/directory/identitygovernance/privilegedaccess/root.py +5 -0
  22. office365/directory/key_credential.py +3 -0
  23. office365/directory/licenses/assignment_state.py +26 -2
  24. office365/directory/licenses/details.py +4 -3
  25. office365/directory/licenses/subscribed_sku.py +8 -10
  26. office365/directory/object_collection.py +40 -25
  27. office365/directory/password_credential.py +3 -0
  28. office365/directory/permissions/default_user_role.py +5 -0
  29. office365/directory/permissions/grants/condition_set.py +4 -2
  30. office365/directory/permissions/grants/oauth2.py +7 -10
  31. office365/directory/policies/authorization.py +50 -3
  32. office365/directory/policies/permission_grant.py +2 -0
  33. office365/directory/profile_photo.py +6 -6
  34. office365/directory/protection/riskyusers/risky_user.py +4 -4
  35. office365/directory/rolemanagement/resource_action.py +10 -0
  36. office365/directory/rolemanagement/role_permission.py +10 -0
  37. office365/directory/security/alerts/alert.py +5 -7
  38. office365/directory/security/attacksimulations/landing_page.py +5 -0
  39. office365/directory/security/attacksimulations/operation.py +5 -0
  40. office365/directory/security/attacksimulations/report.py +8 -1
  41. office365/directory/security/attacksimulations/root.py +33 -0
  42. office365/directory/security/attacksimulations/users/__init__.py +0 -0
  43. office365/directory/security/attacksimulations/users/details.py +5 -0
  44. office365/directory/security/hunting_query_results.py +5 -0
  45. office365/directory/security/incidents/incident.py +8 -13
  46. office365/directory/security/security.py +20 -3
  47. office365/directory/serviceprincipals/service_principal.py +3 -4
  48. office365/directory/synchronization/synchronization.py +2 -0
  49. office365/directory/users/activities/history_item.py +3 -2
  50. office365/directory/users/user.py +37 -10
  51. office365/entity_collection.py +3 -2
  52. office365/graph_client.py +58 -30
  53. office365/intune/audit/event.py +1 -3
  54. office365/intune/audit/event_collection.py +1 -1
  55. office365/intune/devices/alternative_security_id.py +4 -0
  56. office365/intune/devices/collection.py +57 -0
  57. office365/intune/devices/device.py +38 -10
  58. office365/intune/devices/management/management.py +12 -0
  59. office365/intune/organizations/organization.py +1 -0
  60. office365/onedrive/analytics/item_activity_stat.py +9 -0
  61. office365/onedrive/analytics/item_analytics.py +1 -0
  62. office365/onedrive/contenttypes/content_type.py +4 -12
  63. office365/onedrive/driveitems/driveItem.py +2 -1
  64. office365/onedrive/files/hashes.py +5 -0
  65. office365/onedrive/lists/collection.py +2 -2
  66. office365/onedrive/operations/long_running.py +6 -6
  67. office365/onedrive/operations/rich_long_running.py +4 -3
  68. office365/onedrive/permissions/collection.py +1 -14
  69. office365/onedrive/sharepoint_settings.py +6 -6
  70. office365/onedrive/sites/sites_with_root.py +1 -3
  71. office365/onedrive/termstore/store.py +2 -4
  72. office365/onedrive/termstore/terms/collection.py +1 -2
  73. office365/onedrive/workbooks/filter.py +9 -0
  74. office365/onedrive/workbooks/filter_criteria.py +5 -0
  75. office365/onedrive/workbooks/functions/functions.py +6 -3
  76. office365/onedrive/workbooks/functions/result.py +2 -0
  77. office365/onedrive/workbooks/operations/workbook.py +7 -10
  78. office365/onedrive/workbooks/tables/pivot_table.py +9 -9
  79. office365/onedrive/workbooks/worksheets/collection.py +0 -6
  80. office365/onedrive/workbooks/worksheets/protection.py +2 -0
  81. office365/outlook/calendar/permissions/permission.py +7 -7
  82. office365/outlook/calendar/place.py +5 -3
  83. office365/outlook/mail/attachments/collection.py +6 -1
  84. office365/outlook/mail/messages/message.py +1 -1
  85. office365/reports/root.py +50 -4
  86. office365/runtime/auth/providers/acs_token_provider.py +10 -7
  87. office365/runtime/auth/sts_profile.py +0 -1
  88. office365/runtime/client_object.py +18 -14
  89. office365/runtime/client_object_collection.py +8 -23
  90. office365/runtime/client_request_exception.py +1 -3
  91. office365/runtime/client_result.py +11 -14
  92. office365/runtime/client_runtime_context.py +11 -21
  93. office365/runtime/odata/json_format.py +4 -7
  94. office365/runtime/odata/v3/batch_request.py +7 -15
  95. office365/runtime/odata/v4/batch_request.py +13 -21
  96. office365/runtime/types/event_handler.py +1 -1
  97. office365/search/entity.py +3 -2
  98. office365/sharepoint/activities/facets/delete.py +1 -1
  99. office365/sharepoint/activities/tracked_item_service.py +2 -3
  100. office365/sharepoint/administration/web_application.py +8 -7
  101. office365/sharepoint/audit/audit.py +3 -2
  102. office365/sharepoint/changes/alert.py +4 -3
  103. office365/sharepoint/changes/collection.py +7 -10
  104. office365/sharepoint/changes/content_type.py +4 -4
  105. office365/sharepoint/changes/field.py +4 -5
  106. office365/sharepoint/changes/item.py +34 -7
  107. office365/sharepoint/changes/list.py +4 -4
  108. office365/sharepoint/changes/user.py +5 -6
  109. office365/sharepoint/clientsidecomponent/component_context_info.py +4 -3
  110. office365/sharepoint/contentcenter/machinelearning/enabled.py +4 -3
  111. office365/sharepoint/contentcenter/machinelearning/hub.py +6 -6
  112. office365/sharepoint/contentcenter/machinelearning/models/collection.py +1 -1
  113. office365/sharepoint/contenttypes/fieldlinks/collection.py +4 -6
  114. office365/sharepoint/contenttypes/fieldlinks/field_link.py +14 -22
  115. office365/sharepoint/entity.py +12 -5
  116. office365/sharepoint/entity_collection.py +1 -3
  117. office365/sharepoint/eventreceivers/definition.py +8 -12
  118. office365/sharepoint/features/collection.py +1 -2
  119. office365/sharepoint/features/definitions/definition.py +6 -3
  120. office365/sharepoint/fields/calculated.py +8 -14
  121. office365/sharepoint/fields/collection.py +42 -10
  122. office365/sharepoint/fields/computed.py +4 -5
  123. office365/sharepoint/fields/currency.py +7 -11
  124. office365/sharepoint/fields/date_time.py +4 -8
  125. office365/sharepoint/fields/field.py +6 -16
  126. office365/sharepoint/fields/lookup.py +11 -9
  127. office365/sharepoint/fields/multi_choice.py +8 -12
  128. office365/sharepoint/fields/multi_line_text.py +10 -14
  129. office365/sharepoint/fields/number.py +13 -26
  130. office365/sharepoint/fields/rating_scale.py +6 -10
  131. office365/sharepoint/fields/related_field.py +10 -17
  132. office365/sharepoint/fields/url.py +4 -5
  133. office365/sharepoint/fields/user.py +10 -9
  134. office365/sharepoint/files/collection.py +17 -15
  135. office365/sharepoint/files/file.py +30 -23
  136. office365/sharepoint/folders/collection.py +22 -5
  137. office365/sharepoint/folders/coloring.py +11 -9
  138. office365/sharepoint/folders/coloring_information.py +38 -0
  139. office365/sharepoint/folders/folder.py +22 -22
  140. office365/sharepoint/likes/liked_by_information.py +7 -10
  141. office365/sharepoint/likes/user_entity.py +6 -8
  142. office365/sharepoint/listitems/form_update_value.py +17 -1
  143. office365/sharepoint/listitems/listitem.py +2 -2
  144. office365/sharepoint/lists/bloom_filter.py +5 -7
  145. office365/sharepoint/lists/creatables_info.py +5 -6
  146. office365/sharepoint/lists/list.py +24 -9
  147. office365/sharepoint/lists/template.py +7 -4
  148. office365/sharepoint/lists/template_collection.py +2 -4
  149. office365/sharepoint/marketplace/app_metadata.py +14 -23
  150. office365/sharepoint/marketplace/sitecollection/appcatalog/allowed_item.py +6 -8
  151. office365/sharepoint/navigation/node.py +5 -8
  152. office365/sharepoint/permissions/irm/effective_settings.py +6 -8
  153. office365/sharepoint/permissions/irm/file_settings.py +8 -6
  154. office365/sharepoint/permissions/irm/settings.py +25 -43
  155. office365/sharepoint/portal/groups/site_manager.py +6 -7
  156. office365/sharepoint/publishing/embed_data_v1.py +8 -15
  157. office365/sharepoint/publishing/pages/campaign_publication.py +4 -3
  158. office365/sharepoint/publishing/primary_city_time.py +8 -9
  159. office365/sharepoint/publishing/video/service_discoverer.py +4 -3
  160. office365/sharepoint/pushnotifications/subscriber.py +11 -15
  161. office365/sharepoint/sharing/object_sharing_settings.py +24 -46
  162. office365/sharepoint/sharing/permission_information.py +5 -5
  163. office365/sharepoint/sharing/result.py +1 -0
  164. office365/sharepoint/sitedesigns/run.py +4 -3
  165. office365/sharepoint/sites/site.py +7 -16
  166. office365/sharepoint/taxonomy/field.py +32 -21
  167. office365/sharepoint/taxonomy/groups/group.py +12 -1
  168. office365/sharepoint/taxonomy/sets/set.py +6 -0
  169. office365/sharepoint/taxonomy/stores/store.py +4 -2
  170. office365/sharepoint/teams/channel.py +6 -6
  171. office365/sharepoint/tenant/administration/endpoints.py +4 -3
  172. office365/sharepoint/tenant/administration/hubsites/properties.py +4 -5
  173. office365/sharepoint/tenant/administration/sites/properties.py +0 -1
  174. office365/sharepoint/tenant/administration/spo_operation.py +4 -4
  175. office365/sharepoint/tenant/administration/tenant.py +1 -0
  176. office365/sharepoint/tenant/insights/report.py +11 -0
  177. office365/sharepoint/tenant/insights/report_manager.py +5 -0
  178. office365/sharepoint/tenant/insights/report_metadata.py +5 -0
  179. office365/sharepoint/tenant/settings.py +4 -3
  180. office365/sharepoint/translation/sync_translator.py +3 -2
  181. office365/sharepoint/ui/applicationpages/peoplepicker/entity_information.py +4 -4
  182. office365/sharepoint/usercustomactions/action.py +12 -20
  183. office365/sharepoint/userprofiles/followed_content.py +6 -10
  184. office365/sharepoint/userprofiles/people_manager.py +0 -1
  185. office365/sharepoint/userprofiles/person_properties.py +14 -30
  186. office365/sharepoint/userprofiles/personal_cache.py +4 -3
  187. office365/sharepoint/userprofiles/properties_for_user.py +4 -5
  188. office365/sharepoint/userprofiles/sharedwithme/document.py +12 -21
  189. office365/sharepoint/utilities/move_copy_util.py +19 -19
  190. office365/sharepoint/utilities/upload_status.py +7 -10
  191. office365/sharepoint/views/field_collection.py +9 -14
  192. office365/sharepoint/views/view.py +43 -64
  193. office365/sharepoint/webhooks/subscription.py +11 -19
  194. office365/sharepoint/webparts/webpart.py +3 -1
  195. office365/sharepoint/webs/modernize_homepage_result.py +4 -3
  196. office365/sharepoint/webs/regional_settings.py +9 -17
  197. office365/sharepoint/webs/template.py +3 -5
  198. office365/sharepoint/webs/web.py +14 -20
  199. office365/teams/operations/async_operation.py +5 -7
  200. office365/runtime/paths/item.py +0 -8
  201. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/LICENSE +0 -0
  202. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/WHEEL +0 -0
  203. {Office365_REST_Python_Client-2.5.5.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/top_level.txt +0 -0
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",
@@ -65,3 +65,12 @@ class ItemActivityStat(Entity):
65
65
  ResourcePath("activities", self.resource_path),
66
66
  ),
67
67
  )
68
+
69
+ def get_property(self, name, default_value=None):
70
+ if default_value is None:
71
+ property_mapping = {
72
+ "endDateTime": self.end_datetime,
73
+ "startDateTime": self.start_datetime,
74
+ }
75
+ default_value = property_mapping.get(name, None)
76
+ return super(ItemActivityStat, self).get_property(name, default_value)
@@ -19,6 +19,7 @@ class ItemAnalytics(Entity):
19
19
 
20
20
  @property
21
21
  def item_activity_stats(self):
22
+ # type: () -> EntityCollection[ItemActivityStat]
22
23
  return self.properties.get(
23
24
  "itemActivityStats",
24
25
  EntityCollection(
@@ -20,9 +20,7 @@ class ContentType(BaseItem):
20
20
  columns that must be present on every listItem in a list."""
21
21
 
22
22
  def is_published(self):
23
- """
24
- Check the publishing status of a contentType in a content type hub site.
25
- """
23
+ """Check the publishing status of a contentType in a content type hub site."""
26
24
  return_type = ClientResult(self.context, bool())
27
25
  qry = FunctionQuery(self, "isPublished", None, return_type)
28
26
  self.context.add_query(qry)
@@ -57,9 +55,7 @@ class ContentType(BaseItem):
57
55
  return self
58
56
 
59
57
  def unpublish(self):
60
- """
61
- Unpublish a contentType from a content type hub site.
62
- """
58
+ """Unpublish a contentType from a content type hub site."""
63
59
  qry = ServiceOperationQuery(self, "unpublish")
64
60
  self.context.add_query(qry)
65
61
  return self
@@ -75,9 +71,7 @@ class ContentType(BaseItem):
75
71
 
76
72
  @property
77
73
  def document_set(self):
78
- """
79
- Document Set metadata.
80
- """
74
+ """Document Set metadata."""
81
75
  return self.properties.get("documentSet", DocumentSet())
82
76
 
83
77
  @property
@@ -115,9 +109,7 @@ class ContentType(BaseItem):
115
109
  @property
116
110
  def read_only(self):
117
111
  # type: () -> Optional[bool]
118
- """
119
- If true, the content type cannot be modified unless this value is first set to false.
120
- """
112
+ """If true, the content type cannot be modified unless this value is first set to false."""
121
113
  return self.properties.get("readOnly", None)
122
114
 
123
115
  @property
@@ -209,7 +209,8 @@ class DriveItem(BaseItem):
209
209
  :param int chunk_size: chunk size
210
210
  """
211
211
 
212
- def _start_upload():
212
+ def _start_upload(result):
213
+ # type: (ClientResult[UploadSession]) -> None
213
214
  with open(source_path, "rb") as local_file:
214
215
  session_request = UploadSessionRequest(
215
216
  local_file, chunk_size, chunk_uploaded
@@ -0,0 +1,5 @@
1
+ from office365.runtime.client_value import ClientValue
2
+
3
+
4
+ class Hashes(ClientValue):
5
+ """The Hashes resource groups available hashes into a single structure for an item."""
@@ -1,6 +1,6 @@
1
1
  from office365.entity_collection import EntityCollection
2
2
  from office365.onedrive.lists.list import List
3
- from office365.runtime.paths.item import ItemPath
3
+ from office365.runtime.paths.v4.entity import EntityPath
4
4
  from office365.runtime.queries.create_entity import CreateEntityQuery
5
5
 
6
6
 
@@ -17,7 +17,7 @@ class ListCollection(EntityCollection[List]):
17
17
  :param str display_name: The displayable title of the list.
18
18
  :param str list_template: The base list template used in creating the list
19
19
  """
20
- return_type = List(self.context, ItemPath(self.resource_path))
20
+ return_type = List(self.context, EntityPath(None, self.resource_path))
21
21
  self.add_child(return_type)
22
22
  payload = {
23
23
  "displayName": display_name,
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
 
3
5
 
@@ -6,14 +8,12 @@ class LongRunningOperation(Entity):
6
8
 
7
9
  @property
8
10
  def resource_location(self):
9
- """URI of the resource that the operation is performed on.
10
- :rtype: str or None
11
- """
11
+ # type: () -> Optional[str]
12
+ """URI of the resource that the operation is performed on."""
12
13
  return self.properties.get("resourceLocation", None)
13
14
 
14
15
  @property
15
16
  def status_detail(self):
16
- """Details about the status of the operation.
17
- :rtype: str or None
18
- """
17
+ # type: () -> Optional[str]
18
+ """Details about the status of the operation."""
19
19
  return self.properties.get("statusDetail", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.onedrive.operations.long_running import LongRunningOperation
2
4
 
3
5
 
@@ -6,7 +8,6 @@ class RichLongRunningOperation(LongRunningOperation):
6
8
 
7
9
  @property
8
10
  def resource_id(self):
9
- """The unique identifier for the result.
10
- :rtype: str or None
11
- """
11
+ # type: () -> Optional[str]
12
+ """The unique identifier for the result."""
12
13
  return self.properties.get("resourceId", None)
@@ -69,19 +69,6 @@ class PermissionCollection(EntityCollection[Permission]):
69
69
  identity.ensure_properties(["displayName"], _add)
70
70
  return return_type
71
71
 
72
- def delete(self, roles, identity):
73
- # type: (list[str], Application|User|Group|Device) -> Permission
74
- """Deletes the permission."""
75
-
76
- def _delete(col):
77
- pass
78
-
79
- def _identity_loaded():
80
- self.get_all(page_loaded=_delete)
81
-
82
- identity.ensure_property("id", _identity_loaded)
83
- return self
84
-
85
72
  def delete_all(self):
86
73
  """Remove all access to resource"""
87
74
 
@@ -90,5 +77,5 @@ class PermissionCollection(EntityCollection[Permission]):
90
77
  for permission in return_type:
91
78
  permission.delete_object()
92
79
 
93
- self.context.load(self, after_loaded=_after_loaded)
80
+ self.get().after_execute(_after_loaded)
94
81
  return self
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.runtime.types.collections import StringCollection
3
5
 
@@ -26,26 +28,24 @@ class SharepointSettings(Entity):
26
28
 
27
29
  @property
28
30
  def site_creation_default_managed_path(self):
31
+ # type: () -> Optional[str]
29
32
  """
30
33
  The value of the team site managed path. This is the path under which new team sites will be created.
31
- :rtype: str
32
34
  """
33
35
  return self.properties.get("siteCreationDefaultManagedPath", None)
34
36
 
35
37
  @property
36
38
  def site_creation_default_storage_limit_in_mb(self):
37
- """
38
- The default storage quota for a new site upon creation. Measured in megabytes (MB).
39
- :rtype: int
40
- """
39
+ # type: () -> Optional[int]
40
+ """The default storage quota for a new site upon creation. Measured in megabytes (MB)."""
41
41
  return self.properties.get("siteCreationDefaultStorageLimitInMB", None)
42
42
 
43
43
  @property
44
44
  def tenant_default_timezone(self):
45
+ # type: () -> Optional[str]
45
46
  """
46
47
  The default timezone of a tenant for newly created sites. For a list of possible values,
47
48
  see SPRegionalSettings.TimeZones property.
48
- :rtype: str
49
49
  """
50
50
  return self.properties.get("tenantDefaultTimezone", None)
51
51
 
@@ -15,9 +15,7 @@ class SitesWithRoot(EntityCollection[Site]):
15
15
  super(SitesWithRoot, self).__init__(context, Site, resource_path)
16
16
 
17
17
  def get_all_sites(self):
18
- """
19
- List root sites across geographies in an organization.
20
- """
18
+ """List root sites across geographies in an organization."""
21
19
  return_type = SitesWithRoot(self.context)
22
20
  qry = FunctionQuery(self, "getAllSites", return_type=return_type)
23
21
  self.context.add_query(qry)
@@ -3,7 +3,6 @@ from typing import Optional
3
3
  from office365.entity import Entity
4
4
  from office365.entity_collection import EntityCollection
5
5
  from office365.onedrive.termstore.groups.collection import GroupCollection
6
- from office365.onedrive.termstore.groups.group import Group
7
6
  from office365.onedrive.termstore.sets.collection import SetCollection
8
7
  from office365.onedrive.termstore.sets.set import Set
9
8
  from office365.runtime.paths.resource_path import ResourcePath
@@ -23,10 +22,9 @@ class Store(Entity):
23
22
 
24
23
  def _groups_loaded(groups):
25
24
  # type: (GroupCollection) -> None
26
- for g in groups:
27
- self.context.load(g.sets, after_loaded=_sets_loaded)
25
+ [grp.sets.get().after_execute(_sets_loaded) for grp in groups]
28
26
 
29
- self.context.load(self.groups, after_loaded=_groups_loaded)
27
+ self.groups.get().after_execute(_groups_loaded)
30
28
 
31
29
  return return_type
32
30
 
@@ -5,7 +5,7 @@ from office365.runtime.client_value_collection import ClientValueCollection
5
5
  from office365.runtime.queries.create_entity import CreateEntityQuery
6
6
 
7
7
 
8
- class TermCollection(EntityCollection):
8
+ class TermCollection(EntityCollection[Term]):
9
9
  def __init__(self, context, resource_path=None, parent_set=None):
10
10
  """
11
11
  :param office365.onedrive.termstore.sets.set.Set parent_set: The parent set that contains the term
@@ -17,7 +17,6 @@ class TermCollection(EntityCollection):
17
17
  """Create a new term object.
18
18
 
19
19
  :param str label: The name of the label.
20
- :rtype: Term
21
20
  """
22
21
  return_type = Term(self.context)
23
22
  self.add_child(return_type)
@@ -1,5 +1,14 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
4
+ from office365.onedrive.workbooks.filter_criteria import WorkbookFilterCriteria
2
5
 
3
6
 
4
7
  class WorkbookFilter(Entity):
5
8
  """Manages the filtering of a table's column."""
9
+
10
+ @property
11
+ def criteria(self):
12
+ # type: () -> Optional[WorkbookFilterCriteria]
13
+ """The currently applied filter on the given column."""
14
+ return self.properties.get("criteria", WorkbookFilterCriteria())