Office365-REST-Python-Client 2.5.6__py3-none-any.whl → 2.5.8__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 (147) hide show
  1. {Office365_REST_Python_Client-2.5.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/METADATA +5 -5
  2. {Office365_REST_Python_Client-2.5.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/RECORD +147 -96
  3. office365/communications/onlinemeetings/online_meeting.py +30 -3
  4. office365/communications/onlinemeetings/recordings/__init__.py +0 -0
  5. office365/communications/onlinemeetings/recordings/call.py +5 -0
  6. office365/communications/onlinemeetings/transcripts/__init__.py +0 -0
  7. office365/directory/administrative_unit.py +9 -2
  8. office365/directory/applications/roles/collection.py +5 -1
  9. office365/directory/applications/roles/role.py +1 -1
  10. office365/directory/audit/provisioning/object_summary.py +30 -1
  11. office365/directory/authentication/methods/fido.py +8 -0
  12. office365/directory/authentication/methods/password.py +23 -0
  13. office365/directory/custom_security_attribute_definition.py +7 -0
  14. office365/directory/device_local_credential_info.py +6 -0
  15. office365/directory/directory.py +40 -12
  16. office365/directory/identitygovernance/appconsent/request_collection.py +1 -1
  17. office365/directory/identitygovernance/entitlementmanagement/entitlement_management.py +7 -0
  18. office365/directory/identitygovernance/governance.py +16 -0
  19. office365/directory/identitygovernance/termsofuse/agreement_acceptance.py +8 -0
  20. office365/directory/identitygovernance/userconsent/request_collection.py +1 -1
  21. office365/directory/insights/resource_reference.py +1 -1
  22. office365/directory/policies/device_registration.py +6 -0
  23. office365/directory/policies/root.py +13 -0
  24. office365/directory/security/threatintelligence/article_indicator.py +7 -0
  25. office365/directory/serviceprincipals/service_principal.py +109 -25
  26. office365/directory/synchronization/schema.py +16 -0
  27. office365/directory/users/user.py +23 -0
  28. office365/graph_client.py +8 -0
  29. office365/onedrive/driveitems/driveItem.py +86 -6
  30. office365/onedrive/driveitems/retention_label.py +25 -0
  31. office365/onedrive/lists/list.py +1 -1
  32. office365/onedrive/sitepages/__init__.py +0 -0
  33. office365/onedrive/sitepages/base.py +29 -0
  34. office365/onedrive/sitepages/canvas_layout.py +43 -0
  35. office365/onedrive/sitepages/collection.py +32 -0
  36. office365/onedrive/sitepages/horizontal_section.py +23 -0
  37. office365/onedrive/sitepages/horizontal_section_column.py +27 -0
  38. office365/onedrive/sitepages/site_page.py +116 -0
  39. office365/onedrive/sitepages/title_area.py +13 -0
  40. office365/onedrive/sitepages/vertical_section.py +27 -0
  41. office365/onedrive/sitepages/web_part.py +5 -0
  42. office365/onedrive/sites/site.py +10 -0
  43. office365/onedrive/workbooks/charts/chart.py +13 -0
  44. office365/onedrive/workbooks/charts/data_labels.py +13 -1
  45. office365/onedrive/workbooks/icon.py +5 -0
  46. office365/onedrive/workbooks/names/named_item.py +6 -0
  47. office365/onedrive/workbooks/ranges/font.py +5 -0
  48. office365/onedrive/workbooks/ranges/format.py +60 -0
  49. office365/onedrive/workbooks/ranges/range.py +12 -0
  50. office365/onedrive/workbooks/ranges/reference.py +6 -0
  51. office365/onedrive/workbooks/sort_field.py +26 -0
  52. office365/onedrive/workbooks/tables/pivot_table_collection.py +16 -0
  53. office365/onedrive/workbooks/tables/sort.py +5 -0
  54. office365/onedrive/workbooks/tables/table.py +57 -0
  55. office365/onedrive/workbooks/worksheets/protection.py +20 -1
  56. office365/onedrive/workbooks/worksheets/protection_options.py +10 -0
  57. office365/onedrive/workbooks/worksheets/worksheet.py +5 -4
  58. office365/outlook/calendar/calendar.py +1 -3
  59. office365/outlook/calendar/events/event.py +45 -0
  60. office365/outlook/calendar/response_status.py +11 -0
  61. office365/outlook/calendar/rooms/room.py +14 -0
  62. office365/outlook/mail/automatic_replies_mailtips.py +5 -0
  63. office365/outlook/mail/conversation.py +1 -3
  64. office365/outlook/mail/folders/folder.py +1 -3
  65. office365/outlook/mail/tips.py +17 -0
  66. office365/planner/plans/plan.py +11 -1
  67. office365/reports/root.py +33 -0
  68. office365/runtime/auth/authentication_context.py +12 -2
  69. office365/runtime/odata/json_format.py +3 -2
  70. office365/runtime/odata/request.py +12 -2
  71. office365/runtime/queries/upload_session.py +5 -0
  72. office365/sharepoint/activities/action_facet.py +17 -0
  73. office365/sharepoint/activities/client_request.py +4 -0
  74. office365/sharepoint/activities/client_response.py +8 -0
  75. office365/sharepoint/activities/entity.py +10 -0
  76. office365/sharepoint/activities/facets/delete.py +1 -0
  77. office365/sharepoint/activities/facets/get_mention.py +10 -0
  78. office365/sharepoint/activities/facets/in_doc.py +4 -0
  79. office365/sharepoint/activities/facets/move.py +14 -0
  80. office365/sharepoint/activities/facets/point_in_time_restore.py +9 -0
  81. office365/sharepoint/activities/facets/revision_set.py +9 -0
  82. office365/sharepoint/activities/facets/task_completed.py +9 -0
  83. office365/sharepoint/activities/facets/version.py +12 -0
  84. office365/sharepoint/activities/identity_item.py +16 -1
  85. office365/sharepoint/alerts/collection.py +2 -1
  86. office365/sharepoint/attachments/attachment.py +6 -9
  87. office365/sharepoint/attachments/collection.py +25 -3
  88. office365/sharepoint/client_context.py +33 -2
  89. office365/sharepoint/comments/collection.py +1 -1
  90. office365/sharepoint/compliance/store_proxy.py +43 -0
  91. office365/sharepoint/contenttypes/content_type.py +13 -1
  92. office365/sharepoint/contenttypes/fieldlinks/collection.py +1 -1
  93. office365/sharepoint/directory/helper.py +2 -0
  94. office365/sharepoint/directory/provider/alternate_id_data.py +9 -0
  95. office365/sharepoint/directory/provider/notification.py +15 -0
  96. office365/sharepoint/directory/provider/object_data.py +14 -0
  97. office365/sharepoint/directory/provider/provider.py +13 -0
  98. office365/sharepoint/entity.py +15 -0
  99. office365/sharepoint/features/collection.py +2 -0
  100. office365/sharepoint/fields/collection.py +4 -3
  101. office365/sharepoint/fields/user_value.py +1 -1
  102. office365/sharepoint/folders/folder.py +3 -5
  103. office365/sharepoint/migrationcenter/deploy_status.py +5 -0
  104. office365/sharepoint/migrationcenter/service/performance/__init__.py +0 -0
  105. office365/sharepoint/migrationcenter/service/performance/dashboard_data.py +9 -0
  106. office365/sharepoint/migrationcenter/service/performance/data.py +7 -0
  107. office365/sharepoint/migrationcenter/service/performance/entity_data.py +5 -0
  108. office365/sharepoint/multigeo/move_job_entity_data.py +9 -0
  109. office365/sharepoint/multigeo/site_move_job_entity_data.py +9 -0
  110. office365/sharepoint/multigeo/user_personal_site_location.py +9 -0
  111. office365/sharepoint/permissions/securable_object.py +2 -0
  112. office365/sharepoint/principal/principal.py +2 -4
  113. office365/sharepoint/recyclebin/item.py +107 -7
  114. office365/sharepoint/sharing/information.py +9 -0
  115. office365/sharepoint/sharing/link_info.py +6 -0
  116. office365/sharepoint/sharing/object_sharing_information.py +2 -0
  117. office365/sharepoint/sharing/permission_collection.py +18 -0
  118. office365/sharepoint/sharing/shared_document_info.py +9 -0
  119. office365/sharepoint/sites/script_safe_domain.py +5 -0
  120. office365/sharepoint/sites/site.py +10 -4
  121. office365/sharepoint/sites/version_policy_manager.py +7 -0
  122. office365/sharepoint/taxonomy/field_value.py +1 -1
  123. office365/sharepoint/tenant/administration/powerapps/__init__.py +0 -0
  124. office365/sharepoint/tenant/administration/powerapps/environment_context.py +8 -0
  125. office365/sharepoint/tenant/administration/secondary_administrators_info.py +5 -0
  126. office365/sharepoint/tenant/administration/tenant.py +14 -0
  127. office365/sharepoint/tenant/cdn_api.py +16 -0
  128. office365/sharepoint/tenant/management/externalusers/results/get.py +4 -0
  129. office365/sharepoint/tenant/management/office365_tenant.py +14 -0
  130. office365/sharepoint/ui/applicationpages/peoplepicker/web_service_interface.py +39 -33
  131. office365/sharepoint/userprofiles/cross_geo_sync.py +37 -0
  132. office365/sharepoint/userprofiles/cross_geo_sync_user_data_batch.py +5 -0
  133. office365/sharepoint/userprofiles/followed_content.py +15 -0
  134. office365/sharepoint/userprofiles/people_manager.py +23 -10
  135. office365/sharepoint/userprofiles/person_properties.py +7 -0
  136. office365/sharepoint/userprofiles/user_profile.py +4 -6
  137. office365/sharepoint/views/view.py +2 -0
  138. office365/sharepoint/webs/information_collection.py +1 -1
  139. office365/sharepoint/webs/regional_settings.py +71 -0
  140. office365/sharepoint/webs/web.py +53 -5
  141. office365/sharepoint/workflowservices/deployment_service.py +9 -0
  142. office365/teams/apps/catalog.py +1 -0
  143. office365/teams/chats/chat.py +4 -0
  144. office365/teams/schedule/schedule.py +6 -2
  145. {Office365_REST_Python_Client-2.5.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/LICENSE +0 -0
  146. {Office365_REST_Python_Client-2.5.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/WHEEL +0 -0
  147. {Office365_REST_Python_Client-2.5.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/top_level.txt +0 -0
@@ -2,8 +2,13 @@ from datetime import datetime
2
2
  from typing import AnyStr, Optional
3
3
 
4
4
  from office365.communications.onlinemeetings.participants import MeetingParticipants
5
+ from office365.communications.onlinemeetings.recordings.call import CallRecording
5
6
  from office365.entity import Entity
7
+ from office365.entity_collection import EntityCollection
6
8
  from office365.outlook.mail.item_body import ItemBody
9
+ from office365.runtime.client_result import ClientResult
10
+ from office365.runtime.paths.resource_path import ResourcePath
11
+ from office365.runtime.queries.function import FunctionQuery
7
12
  from office365.runtime.types.collections import StringCollection
8
13
 
9
14
 
@@ -13,6 +18,17 @@ class OnlineMeeting(Entity):
13
18
  the attendees list, and the description.
14
19
  """
15
20
 
21
+ def get_virtual_appointment_join_web_url(self):
22
+ """Get a join web URL for a Microsoft Virtual Appointment. This web URL includes enhanced
23
+ business-to-customer experiences such as mobile browser join and virtual lobby rooms.
24
+ With Teams Premium, you can configure a custom lobby room experience for attendees by adding your company
25
+ logo and access the Virtual Appointments usage report for organizational analytics.
26
+ """
27
+ return_type = ClientResult(self.context, str())
28
+ qry = FunctionQuery(self, "getVirtualAppointmentJoinWebUrl", None, return_type)
29
+ self.context.add_query(qry)
30
+ return return_type
31
+
16
32
  @property
17
33
  def allow_attendee_to_enable_camera(self):
18
34
  # type: () -> Optional[bool]
@@ -74,9 +90,7 @@ class OnlineMeeting(Entity):
74
90
  @start_datetime.setter
75
91
  def start_datetime(self, value):
76
92
  # type: (datetime) -> None
77
- """
78
- Sets the meeting start time in UTC.
79
- """
93
+ """Sets the meeting start time in UTC."""
80
94
  self.set_property("startDateTime", value.isoformat())
81
95
 
82
96
  @property
@@ -107,6 +121,19 @@ class OnlineMeeting(Entity):
107
121
  """The video teleconferencing ID."""
108
122
  return self.properties.get("videoTeleconferenceId", None)
109
123
 
124
+ @property
125
+ def recordings(self):
126
+ # type: () -> EntityCollection[CallRecording]
127
+ """he recordings of an online meeting"""
128
+ return self.properties.get(
129
+ "recordings",
130
+ EntityCollection(
131
+ self.context,
132
+ CallRecording,
133
+ ResourcePath("recordings", self.resource_path),
134
+ ),
135
+ )
136
+
110
137
  def get_property(self, name, default_value=None):
111
138
  if default_value is None:
112
139
  property_mapping = {
@@ -0,0 +1,5 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class CallRecording(Entity):
5
+ """Represents a recording associated with an online meeting."""
@@ -21,10 +21,17 @@ class AdministrativeUnit(DirectoryObject):
21
21
  return self.properties.get("displayName", None)
22
22
 
23
23
  @property
24
- def members(self):
24
+ def visibility(self):
25
25
  """
26
- Users and groups that are members of this administrative unit
26
+ Controls whether the administrative unit and its members are hidden or public. Can be set to HiddenMembership.
27
+ If not set (value is null), the default behavior is public. When set to HiddenMembership, only members of
28
+ the administrative unit can list other members of the administrative unit.
27
29
  """
30
+ return self.properties.get("visibility", None)
31
+
32
+ @property
33
+ def members(self):
34
+ """Users and groups that are members of this administrative unit"""
28
35
  from office365.directory.object_collection import DirectoryObjectCollection
29
36
 
30
37
  return self.properties.get(
@@ -10,4 +10,8 @@ class AppRoleCollection(ClientValueCollection[AppRole]):
10
10
 
11
11
  def __getitem__(self, key):
12
12
  # type: (str) -> AppRole
13
- return next(iter([item for item in self._data if item.value == key]), None)
13
+ return self.get_by_value(key)
14
+
15
+ def get_by_value(self, value):
16
+ # type: (str) -> AppRole
17
+ return next(iter([item for item in self._data if item.value == value]), None)
@@ -38,4 +38,4 @@ class AppRole(ClientValue):
38
38
  return "{0} {1}".format(self.allowedMemberTypes, self.value)
39
39
 
40
40
  def __repr__(self):
41
- return "{0}".format(self.id)
41
+ return self.value or self.id or self.entity_type_name
@@ -1,3 +1,6 @@
1
+ from datetime import datetime
2
+ from typing import Optional
3
+
1
4
  from office365.directory.audit.provisioning.service_principal import (
2
5
  ProvisioningServicePrincipal,
3
6
  )
@@ -7,6 +10,29 @@ from office365.entity import Entity
7
10
  class ProvisioningObjectSummary(Entity):
8
11
  """Represents an action performed by the Azure AD Provisioning service and its associated properties."""
9
12
 
13
+ @property
14
+ def activity_datetime(self):
15
+ """Represents date and time information using ISO 8601 format and is always in UTC time."""
16
+ return self.properties.get("activityDateTime", datetime.min)
17
+
18
+ @property
19
+ def change_id(self):
20
+ # type: () -> Optional[str]
21
+ """Unique ID of this change in this cycle. Supports $filter (eq, contains)."""
22
+ return self.properties.get("changeId", None)
23
+
24
+ @property
25
+ def cycle_id(self):
26
+ # type: () -> Optional[str]
27
+ """Unique ID per job iteration. Supports $filter (eq, contains)."""
28
+ return self.properties.get("cycleId", None)
29
+
30
+ @property
31
+ def duration_in_milliseconds(self):
32
+ # type: () -> Optional[int]
33
+ """Indicates how long this provisioning action took to finish. Measured in milliseconds."""
34
+ return self.properties.get("durationInMilliseconds", None)
35
+
10
36
  @property
11
37
  def service_principal(self):
12
38
  """Represents the service principal used for provisioning."""
@@ -14,6 +40,9 @@ class ProvisioningObjectSummary(Entity):
14
40
 
15
41
  def get_property(self, name, default_value=None):
16
42
  if default_value is None:
17
- property_mapping = {"servicePrincipal": self.service_principal}
43
+ property_mapping = {
44
+ "activityDateTime": self.activity_datetime,
45
+ "servicePrincipal": self.service_principal,
46
+ }
18
47
  default_value = property_mapping.get(name, None)
19
48
  return super(ProvisioningObjectSummary, self).get_property(name, default_value)
@@ -1,5 +1,13 @@
1
+ from typing import Optional
2
+
1
3
  from office365.directory.authentication.methods.method import AuthenticationMethod
2
4
 
3
5
 
4
6
  class Fido2AuthenticationMethod(AuthenticationMethod):
5
7
  """Representation of a FIDO2 security key registered to a user. FIDO2 is a sign-in authentication method."""
8
+
9
+ @property
10
+ def model(self):
11
+ # type: () -> Optional[str]
12
+ """The manufacturer-assigned model of the FIDO2 security key."""
13
+ return self.properties.get("model", None)
@@ -1,6 +1,29 @@
1
+ from datetime import datetime
2
+ from typing import Optional
3
+
1
4
  from office365.directory.authentication.methods.method import AuthenticationMethod
2
5
 
3
6
 
4
7
  class PasswordAuthenticationMethod(AuthenticationMethod):
5
8
  """A representation of a user's password. For security, the password itself will never be returned in the object,
6
9
  but action can be taken to reset a password."""
10
+
11
+ @property
12
+ def created_datetime(self):
13
+ # type: () -> datetime
14
+ """The date and time when this password was last updated. This property is currently not populated."""
15
+ return self.properties.get("createdDateTime", datetime.min)
16
+
17
+ @property
18
+ def password(self):
19
+ # type: () -> Optional[str]
20
+ """For security, the password is always returned as null from a LIST or GET operation."""
21
+ return self.properties.get("password", None)
22
+
23
+ def get_property(self, name, default_value=None):
24
+ if default_value is None:
25
+ property_mapping = {"createdDateTime": self.created_datetime}
26
+ default_value = property_mapping.get(name, None)
27
+ return super(PasswordAuthenticationMethod, self).get_property(
28
+ name, default_value
29
+ )
@@ -0,0 +1,7 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class CustomSecurityAttributeDefinition(Entity):
5
+ """Represents the schema of a custom security attribute (key-value pair).
6
+ For example, the custom security attribute name, description, data type, and allowed values.
7
+ """
@@ -0,0 +1,6 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class DeviceLocalCredentialInfo(Entity):
5
+ """Represents local administrator credential information for all device objects in Azure Active Directory
6
+ that are enabled with Local Admin Password Solution (LAPS)."""
@@ -1,4 +1,8 @@
1
1
  from office365.directory.administrative_unit import AdministrativeUnit
2
+ from office365.directory.custom_security_attribute_definition import (
3
+ CustomSecurityAttributeDefinition,
4
+ )
5
+ from office365.directory.device_local_credential_info import DeviceLocalCredentialInfo
2
6
  from office365.directory.object_collection import DirectoryObjectCollection
3
7
  from office365.entity import Entity
4
8
  from office365.entity_collection import EntityCollection
@@ -10,6 +14,42 @@ class Directory(Entity):
10
14
  "container". Deleted items will remain available to restore for up to 30 days. After 30 days, the items are
11
15
  permanently deleted."""
12
16
 
17
+ @property
18
+ def device_local_credentials(self):
19
+ """Conceptual container for user and group directory objects."""
20
+ return self.properties.get(
21
+ "deviceLocalCredentials",
22
+ EntityCollection(
23
+ self.context,
24
+ DeviceLocalCredentialInfo,
25
+ ResourcePath("deviceLocalCredentials", self.resource_path),
26
+ ),
27
+ )
28
+
29
+ @property
30
+ def administrative_units(self):
31
+ """Conceptual container for user and group directory objects."""
32
+ return self.properties.get(
33
+ "administrativeUnits",
34
+ EntityCollection(
35
+ self.context,
36
+ AdministrativeUnit,
37
+ ResourcePath("administrativeUnits", self.resource_path),
38
+ ),
39
+ )
40
+
41
+ @property
42
+ def custom_security_attribute_definitions(self):
43
+ """Conceptual container for customSecurityAttributeDefinition objects and their properties."""
44
+ return self.properties.get(
45
+ "customSecurityAttributeDefinitions",
46
+ EntityCollection(
47
+ self.context,
48
+ CustomSecurityAttributeDefinition,
49
+ ResourcePath("customSecurityAttributeDefinitions", self.resource_path),
50
+ ),
51
+ )
52
+
13
53
  def deleted_items(self, entity_type=None):
14
54
  """Recently deleted items. Read-only. Nullable."""
15
55
  if entity_type:
@@ -27,18 +67,6 @@ class Directory(Entity):
27
67
  ),
28
68
  )
29
69
 
30
- @property
31
- def administrative_units(self):
32
- """Conceptual container for user and group directory objects."""
33
- return self.properties.get(
34
- "administrativeUnits",
35
- EntityCollection(
36
- self.context,
37
- AdministrativeUnit,
38
- ResourcePath("administrativeUnits", self.resource_path),
39
- ),
40
- )
41
-
42
70
  @property
43
71
  def deleted_groups(self):
44
72
  """Recently deleted groups"""
@@ -3,7 +3,7 @@ from office365.entity_collection import EntityCollection
3
3
  from office365.runtime.queries.function import FunctionQuery
4
4
 
5
5
 
6
- class AppConsentRequestCollection(EntityCollection):
6
+ class AppConsentRequestCollection(EntityCollection[AppConsentRequest]):
7
7
  """AppConsentRequest's collection"""
8
8
 
9
9
  def __init__(self, context, resource_path=None):
@@ -0,0 +1,7 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class EntitlementManagement(Entity):
5
+ """The entitlement management singleton is the container for entitlement management resources,
6
+ including accessPackageCatalog, connectedOrganization, and entitlementManagementSettings.
7
+ """
@@ -2,6 +2,9 @@ from office365.directory.identitygovernance.accessreview.set import AccessReview
2
2
  from office365.directory.identitygovernance.appconsent.approval_route import (
3
3
  AppConsentApprovalRoute,
4
4
  )
5
+ from office365.directory.identitygovernance.entitlementmanagement.entitlement_management import (
6
+ EntitlementManagement,
7
+ )
5
8
  from office365.directory.identitygovernance.privilegedaccess.root import (
6
9
  PrivilegedAccessRoot,
7
10
  )
@@ -68,3 +71,16 @@ class IdentityGovernance(Entity):
68
71
  self.context, ResourcePath("termsOfUse", self.resource_path)
69
72
  ),
70
73
  )
74
+
75
+ @property
76
+ def entitlement_management(self):
77
+ """
78
+ Container for entitlement management resources, including accessPackageCatalog, connectedOrganization,
79
+ and entitlementManagementSettings.
80
+ """
81
+ return self.properties.get(
82
+ "entitlementManagement",
83
+ EntitlementManagement(
84
+ self.context, ResourcePath("entitlementManagement", self.resource_path)
85
+ ),
86
+ )
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
 
3
5
 
@@ -6,3 +8,9 @@ class AgreementAcceptance(Entity):
6
8
  Represents the current status of a user's response to a company's customizable terms of use agreement powered by
7
9
  Azure Active Directory (Azure AD).
8
10
  """
11
+
12
+ @property
13
+ def user_principal_name(self):
14
+ # type: () -> Optional[str]
15
+ """UPN of the user when the acceptance was recorded."""
16
+ return self.properties.get("userPrincipalName", None)
@@ -4,7 +4,7 @@ from office365.directory.identitygovernance.userconsent.request import (
4
4
  from office365.entity_collection import EntityCollection
5
5
 
6
6
 
7
- class UserConsentRequestCollection(EntityCollection):
7
+ class UserConsentRequestCollection(EntityCollection[UserConsentRequest]):
8
8
  """AppConsentRequest's collection"""
9
9
 
10
10
  def __init__(self, context, resource_path=None):
@@ -15,7 +15,7 @@ class ResourceReference(ClientValue):
15
15
  self.webUrl = web_url
16
16
 
17
17
  def __str__(self):
18
- return self.type
18
+ return self.type or ""
19
19
 
20
20
  def __repr__(self):
21
21
  return "{0}:{1}".format(self.type, self.webUrl)
@@ -0,0 +1,6 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class DeviceRegistrationPolicy(Entity):
5
+ """Represents the policy scope that controls quota restrictions, additional authentication, and authorization
6
+ policies to register device identities to your organization."""
@@ -9,6 +9,7 @@ from office365.directory.policies.authentication_strength import (
9
9
  from office365.directory.policies.authorization import AuthorizationPolicy
10
10
  from office365.directory.policies.conditional_access import ConditionalAccessPolicy
11
11
  from office365.directory.policies.cross_tenant_access import CrossTenantAccessPolicy
12
+ from office365.directory.policies.device_registration import DeviceRegistrationPolicy
12
13
  from office365.directory.policies.permission_grant import PermissionGrantPolicy
13
14
  from office365.directory.policies.tenant_app_management import TenantAppManagementPolicy
14
15
  from office365.entity import Entity
@@ -33,6 +34,17 @@ class PolicyRoot(Entity):
33
34
  ),
34
35
  )
35
36
 
37
+ @property
38
+ def device_registration_policy(self):
39
+ """ """
40
+ return self.properties.get(
41
+ "deviceRegistrationPolicy",
42
+ DeviceRegistrationPolicy(
43
+ self.context,
44
+ ResourcePath("deviceRegistrationPolicy", self.resource_path),
45
+ ),
46
+ )
47
+
36
48
  def authentication_strength_policies(self):
37
49
  # type: () -> EntityCollection[AuthenticationStrengthPolicy]
38
50
  """
@@ -147,6 +159,7 @@ class PolicyRoot(Entity):
147
159
  "conditional_access_policies": self.conditional_access_policies,
148
160
  "crossTenantAccessPolicy": self.cross_tenant_access_policy,
149
161
  "defaultAppManagementPolicy": self.default_app_management_policy,
162
+ "deviceRegistrationPolicy": self.device_registration_policy,
150
163
  "permissionGrantPolicies": self.permission_grant_policies,
151
164
  }
152
165
  default_value = property_mapping.get(name, None)
@@ -0,0 +1,7 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class ArticleIndicator(Entity):
5
+ """
6
+ Represents a resource that communicates indicators of threat or compromise related to the contents of an article
7
+ """
@@ -17,6 +17,7 @@ from office365.directory.password_credential import PasswordCredential
17
17
  from office365.directory.permissions.grants.oauth2 import OAuth2PermissionGrant
18
18
  from office365.directory.permissions.scope import PermissionScope
19
19
  from office365.directory.synchronization.synchronization import Synchronization
20
+ from office365.directory.users.user import User
20
21
  from office365.runtime.client_result import ClientResult
21
22
  from office365.runtime.client_value_collection import ClientValueCollection
22
23
  from office365.runtime.paths.appid import AppIdPath
@@ -101,7 +102,82 @@ class ServicePrincipal(DirectoryObject):
101
102
  self.context.add_query(qry)
102
103
  return return_type
103
104
 
104
- def grant(self, app, app_role):
105
+ def _ensure_client_service_principal(self, app, action):
106
+ if isinstance(app, Application):
107
+
108
+ def _after():
109
+ action(app)
110
+
111
+ app.ensure_property("id", _after)
112
+ else:
113
+ self.context.service_principals.get_by_app(app).get().after_execute(action)
114
+
115
+ def grant_delegated(self, app, principal, scope):
116
+ # type: (Application|str, User|str, AppRole|str) -> Self
117
+ """Grants a delegated permission to the client service principal on behalf of a user"""
118
+
119
+ def _grant_delegated(principal_id, client_id):
120
+ # type: (str, str) -> None
121
+ self.context.oauth2_permission_grants.add(
122
+ clientId=client_id,
123
+ consentType="Principal",
124
+ resourceId=self.id,
125
+ principalId=principal_id,
126
+ scope=scope,
127
+ )
128
+
129
+ def _ensure_app(principal_id):
130
+ def _after(return_type):
131
+ _grant_delegated(principal_id, return_type.id)
132
+
133
+ self._ensure_client_service_principal(app, _after)
134
+
135
+ def _ensure_principal():
136
+ if isinstance(principal, User):
137
+
138
+ def _after():
139
+ _ensure_app(principal.id)
140
+
141
+ principal.ensure_property("id", _after)
142
+ else:
143
+ _ensure_app(principal)
144
+
145
+ self.ensure_property("id", _ensure_principal)
146
+ return self
147
+
148
+ def revoke_delegated(self, app, principal, scope):
149
+ # type: (Application|str, User|str, AppRole|str) -> Self
150
+ """"""
151
+
152
+ def _revoke(app_id, principal_id):
153
+ # type: (str, str) -> None
154
+
155
+ def _after(return_type):
156
+ pass
157
+
158
+ query_text = "clientId eq '{0}' and principalId eq '{1}'".format(
159
+ app_id, principal_id
160
+ )
161
+ # query_text = "clientId eq '{0}'".format(app_id)
162
+ self.context.oauth2_permission_grants.filter(
163
+ query_text
164
+ ).get().after_execute(_after)
165
+
166
+ def _ensure_principal(return_type):
167
+ if isinstance(principal, User):
168
+
169
+ def _after():
170
+ _revoke(principal.id, return_type.id)
171
+
172
+ principal.ensure_property("id", _after)
173
+ else:
174
+ _revoke(principal, return_type.id)
175
+
176
+ self._ensure_client_service_principal(app, _ensure_principal)
177
+ # self.ensure_property("id", _ensure_principal)
178
+ return self
179
+
180
+ def grant_application(self, app, app_role):
105
181
  # type: (Application|str, AppRole|str) -> Self
106
182
  """
107
183
  Grants an app role assignment to a client service principal
@@ -109,46 +185,54 @@ class ServicePrincipal(DirectoryObject):
109
185
  :param AppRole or str app_role: AppRole object or name
110
186
  """
111
187
 
112
- def _grant(principal):
113
- # type: ("ServicePrincipal") -> None
114
- app_role_id = repr(app_role)
115
- principal_id = principal.id
188
+ def _grant(principal_id, app_role_id):
189
+ # type: (str, str) -> None
116
190
  self.app_role_assigned_to.add(
117
191
  principalId=principal_id, resourceId=self.id, appRoleId=app_role_id
118
192
  )
119
193
 
120
- def _ensure_principal():
121
- self.context.service_principals.get_by_app(app).get().after_execute(_grant)
194
+ def _ensure_resource():
195
+ def _after(return_type):
196
+ if isinstance(app_role, AppRole):
197
+ _grant(return_type.id, app_role.id)
198
+ else:
199
+ _grant(return_type.id, self.app_roles[app_role].id)
122
200
 
123
- self.ensure_property("id", _ensure_principal)
201
+ self.context.service_principals.get_by_app(app).get().after_execute(_after)
202
+
203
+ self.ensure_properties(["id", "appRoles"], _ensure_resource)
124
204
  return self
125
205
 
126
- def revoke(self, app, app_role):
206
+ def revoke_application(self, app, app_role):
127
207
  # type: (Application|str, AppRole|str) -> Self
128
208
  """Revokes an app role assignment from a client service principal"""
129
209
 
130
- def _revoke(principal):
131
- # type ("ServicePrincipal") -> None
132
- principal_id = principal.id
133
- app_role_id = repr(app_role)
134
- app_role_assigned_to_ids = [
135
- item.id
210
+ def _revoke(principal_id, app_role_id):
211
+ # type: (str, str) -> None
212
+ app_role_to_revoke = [
213
+ item
136
214
  for item in self.app_role_assigned_to
137
- if item.principal_id == principal_id and item.app_role_id == app_role_id
215
+ # if item.principal_id == principal_id and item.app_role_id == app_role_id
216
+ if item.principal_id == principal_id
138
217
  ]
139
- if len(app_role_assigned_to_ids) > 0:
140
- self.app_role_assigned_to[app_role_assigned_to_ids[0]].delete_object()
218
+ if len(app_role_to_revoke) > 0:
219
+ self.app_role_assigned_to[app_role_to_revoke[0].id].delete_object()
141
220
 
142
- def _ensure_resource(principal):
143
- self.ensure_properties(["id", "appRoleAssignedTo"], _revoke, principal)
144
- # self.app_role_assigned_to.get_all(page_loaded=_revoke)
221
+ def _ensure_app_role(principal):
222
+ # type: ("ServicePrincipal") -> None
223
+ if isinstance(app_role, AppRole):
224
+ _revoke(principal.id, app_role.id)
225
+ else:
226
+ _revoke(principal.id, self.app_roles[app_role].id)
145
227
 
146
228
  def _ensure_principal():
147
- self.context.service_principals.get_by_app(app).get().after_execute(
148
- _ensure_resource
149
- )
229
+ self.context.service_principals.get_by_app(app).select(
230
+ ["id"]
231
+ ).get().after_execute(_ensure_app_role)
150
232
 
151
- self.ensure_property("id", _ensure_principal)
233
+ self.ensure_properties(
234
+ ["id", "appId", "appRoles", "appRoleAssignedTo"], _ensure_principal
235
+ )
152
236
  return self
153
237
 
154
238
  def remove_password(self, key_id):
@@ -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
+ )
@@ -50,6 +50,7 @@ from office365.outlook.mail.mailbox_settings import MailboxSettings
50
50
  from office365.outlook.mail.messages.collection import MessageCollection
51
51
  from office365.outlook.mail.messages.message import Message
52
52
  from office365.outlook.mail.recipient import Recipient
53
+ from office365.outlook.mail.tips import MailTips
53
54
  from office365.outlook.user import OutlookUser
54
55
  from office365.planner.user import PlannerUser
55
56
  from office365.runtime.client_result import ClientResult
@@ -169,6 +170,28 @@ class User(DirectoryObject):
169
170
  self.context.add_query(qry)
170
171
  return self
171
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
+
172
195
  def send_mail(
173
196
  self,
174
197
  subject,