Office365-REST-Python-Client 2.5.12__py3-none-any.whl → 2.5.13__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 (86) hide show
  1. {Office365_REST_Python_Client-2.5.12.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/METADATA +1 -1
  2. {Office365_REST_Python_Client-2.5.12.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/RECORD +86 -51
  3. office365/backuprestore/__init__.py +0 -0
  4. office365/backuprestore/root.py +39 -0
  5. office365/backuprestore/service_status.py +5 -0
  6. office365/booking/solutions/root.py +14 -1
  7. office365/directory/applications/application.py +17 -0
  8. office365/directory/applications/optional_claim.py +5 -0
  9. office365/directory/applications/optional_claims.py +16 -0
  10. office365/directory/authentication/conditions/event_listener.py +9 -0
  11. office365/directory/device_local_credential_info.py +21 -0
  12. office365/directory/identities/container.py +18 -0
  13. office365/directory/policies/authentication_flows.py +8 -0
  14. office365/directory/policies/root.py +17 -0
  15. office365/directory/policies/unified_role_management.py +7 -0
  16. office365/directory/protection/policy/__init__.py +0 -0
  17. office365/directory/protection/policy/base.py +24 -0
  18. office365/directory/protection/policy/one_drive_for_business.py +10 -0
  19. office365/directory/security/attacksimulations/users/details.py +7 -0
  20. office365/directory/serviceprincipals/service_principal.py +65 -14
  21. office365/directory/users/user.py +23 -3
  22. office365/graph_client.py +3 -1
  23. office365/intune/devices/management/management.py +26 -0
  24. office365/intune/devices/management/terms_and_conditions.py +10 -0
  25. office365/intune/devices/management/virtual_endpoint.py +8 -0
  26. office365/runtime/client_object.py +9 -1
  27. office365/runtime/client_object_collection.py +2 -2
  28. office365/runtime/client_result.py +19 -2
  29. office365/runtime/odata/v4/batch_request.py +12 -15
  30. office365/sharepoint/apps/context_site.py +41 -0
  31. office365/sharepoint/authpolicy/events/collection.py +11 -0
  32. office365/sharepoint/authpolicy/events/{auth_event.py → event.py} +1 -0
  33. office365/sharepoint/authpolicy/events/role_assignment_resource_payload.py +5 -0
  34. office365/sharepoint/brandcenter/__init__.py +0 -0
  35. office365/sharepoint/brandcenter/brand_center.py +9 -0
  36. office365/sharepoint/brandcenter/configuration.py +5 -0
  37. office365/sharepoint/changes/change.py +1 -3
  38. office365/sharepoint/changes/collection.py +3 -0
  39. office365/sharepoint/changes/folder.py +6 -0
  40. office365/sharepoint/changes/group.py +3 -0
  41. office365/sharepoint/changes/list.py +13 -0
  42. office365/sharepoint/changes/view.py +25 -0
  43. office365/sharepoint/client_context.py +19 -1
  44. office365/sharepoint/contenttypes/fieldlinks/collection.py +3 -0
  45. office365/sharepoint/copilot/__init__.py +0 -0
  46. office365/sharepoint/copilot/file_collection.py +27 -0
  47. office365/sharepoint/copilot/file_collection_query_result.py +10 -0
  48. office365/sharepoint/copilot/list_item_extensions.py +5 -0
  49. office365/sharepoint/directory/provider/alternate_id_data.py +5 -0
  50. office365/sharepoint/directory/provider/notification.py +8 -0
  51. office365/sharepoint/directory/provider/object_changes.py +5 -0
  52. office365/sharepoint/directory/provider/object_data.py +26 -3
  53. office365/sharepoint/directory/provider/provider.py +1 -0
  54. office365/sharepoint/directory/provider/session_data.py +9 -0
  55. office365/sharepoint/lists/list.py +64 -1
  56. office365/sharepoint/logger/log_export.py +2 -0
  57. office365/sharepoint/migrationcenter/service/performance/data.py +5 -5
  58. office365/sharepoint/multigeo/services.py +24 -0
  59. office365/sharepoint/navigation/menu_node.py +43 -1
  60. office365/sharepoint/navigation/node_collection.py +1 -1
  61. office365/sharepoint/oauth/token.py +22 -0
  62. office365/sharepoint/oauth/token_response.py +5 -0
  63. office365/sharepoint/publishing/pages/campaign_publication.py +10 -0
  64. office365/sharepoint/securestore/target_application.py +2 -0
  65. office365/sharepoint/sharing/inherited_from.py +5 -0
  66. office365/sharepoint/sharing/internal/__init__.py +0 -0
  67. office365/sharepoint/sharing/internal/sharing_restrictions.py +22 -0
  68. office365/sharepoint/sharing/internal/types.py +17 -0
  69. office365/sharepoint/sharing/link_info.py +24 -0
  70. office365/sharepoint/sites/site.py +9 -0
  71. office365/sharepoint/sites/version_policy_manager.py +8 -0
  72. office365/sharepoint/tenant/administration/policies/__init__.py +0 -0
  73. office365/sharepoint/tenant/administration/policies/definition.py +5 -0
  74. office365/sharepoint/tenant/administration/settings_service.py +9 -1
  75. office365/sharepoint/tenant/administration/sites/properties.py +45 -0
  76. office365/sharepoint/tenant/administration/tenant.py +14 -0
  77. office365/sharepoint/tenant/administration/types.py +17 -1
  78. office365/sharepoint/utilities/wopi_host.py +45 -0
  79. office365/sharepoint/webs/regional_settings.py +6 -0
  80. office365/sharepoint/webs/web.py +56 -0
  81. office365/sharepoint/workflow/definition.py +5 -0
  82. office365/sharepoint/workflowservices/deployment_service.py +23 -0
  83. office365/teams/members/settings.py +2 -2
  84. {Office365_REST_Python_Client-2.5.12.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/LICENSE +0 -0
  85. {Office365_REST_Python_Client-2.5.12.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/WHEEL +0 -0
  86. {Office365_REST_Python_Client-2.5.12.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,16 @@
1
+ from office365.directory.applications.optional_claim import OptionalClaim
2
+ from office365.runtime.client_value import ClientValue
3
+ from office365.runtime.client_value_collection import ClientValueCollection
4
+
5
+
6
+ class OptionalClaims(ClientValue):
7
+ """An application can configure optional claims to be returned in each of three types of tokens
8
+ (ID token, access token, SAML 2 token) it can receive from the security token service.
9
+ An application can configure a different set of optional claims to be returned in each token type.
10
+ The optionalClaims property of the application is an optionalClaims object."""
11
+
12
+ def __init__(self, access_token=None, id_token=None, saml2_token=None):
13
+ """ """
14
+ self.accessToken = ClientValueCollection(OptionalClaim, access_token)
15
+ self.idToken = ClientValueCollection(OptionalClaim, id_token)
16
+ self.saml2Token = ClientValueCollection(OptionalClaim, saml2_token)
@@ -0,0 +1,9 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class AuthenticationEventListener(Entity):
5
+ """
6
+ Defines a listener to evaluate when an authentication event happens in an authentication experience.
7
+ An authenticationListener is abstract and is the base class of the various types of listeners you can evaluate
8
+ during an authentication event.
9
+ """
@@ -1,6 +1,27 @@
1
+ from datetime import datetime
2
+ from typing import Optional
3
+
1
4
  from office365.entity import Entity
2
5
 
3
6
 
4
7
  class DeviceLocalCredentialInfo(Entity):
5
8
  """Represents local administrator credential information for all device objects in Azure Active Directory
6
9
  that are enabled with Local Admin Password Solution (LAPS)."""
10
+
11
+ @property
12
+ def device_name(self):
13
+ # type: () -> Optional[str]
14
+ """
15
+ Display name of the device that the local credentials are associated with.
16
+ """
17
+ return self.properties.get("deviceName", None)
18
+
19
+ @property
20
+ def last_backup_datetime(self):
21
+ """When the local administrator account credential was backed up to Azure Active Directory."""
22
+ return self.properties.get("lastBackupDateTime", datetime.min)
23
+
24
+ @property
25
+ def refresh_datetime(self):
26
+ """When the local administrator account credential will be refreshed and backed up to Azure Active Directory."""
27
+ return self.properties.get("refreshDateTime", datetime.min)
@@ -1,3 +1,6 @@
1
+ from office365.directory.authentication.conditions.event_listener import (
2
+ AuthenticationEventListener,
3
+ )
1
4
  from office365.directory.identities.api_connector import IdentityApiConnector
2
5
  from office365.directory.identities.conditional_access_root import ConditionalAccessRoot
3
6
  from office365.directory.identities.providers.base_collection import (
@@ -18,6 +21,7 @@ class IdentityContainer(Entity):
18
21
 
19
22
  @property
20
23
  def api_connectors(self):
24
+ # type: () -> EntityCollection[IdentityApiConnector]
21
25
  """Represents entry point for API connectors."""
22
26
  return self.properties.get(
23
27
  "apiConnectors",
@@ -28,6 +32,19 @@ class IdentityContainer(Entity):
28
32
  ),
29
33
  )
30
34
 
35
+ @property
36
+ def authentication_event_listeners(self):
37
+ # type: () -> EntityCollection[AuthenticationEventListener]
38
+ """Get the collection of authenticationListener resources supported by the onSignupStart event."""
39
+ return self.properties.get(
40
+ "authenticationEventListeners",
41
+ EntityCollection(
42
+ self.context,
43
+ AuthenticationEventListener,
44
+ ResourcePath("authenticationEventListeners", self.resource_path),
45
+ ),
46
+ )
47
+
31
48
  @property
32
49
  def conditional_access(self):
33
50
  """The entry point for the Conditional Access (CA) object model."""
@@ -76,6 +93,7 @@ class IdentityContainer(Entity):
76
93
  if default_value is None:
77
94
  property_mapping = {
78
95
  "apiConnectors": self.api_connectors,
96
+ "authenticationEventListeners": self.authentication_event_listeners,
79
97
  "b2xUserFlows": self.b2x_user_flows,
80
98
  "conditionalAccess": self.conditional_access,
81
99
  "identityProviders": self.identity_providers,
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
 
3
5
 
@@ -7,3 +9,9 @@ class AuthenticationFlowsPolicy(Entity):
7
9
  users request to sign up for approval. It contains information, such as the identifier, display name, and
8
10
  description, and indicates whether self-service sign-up is enabled for the policy.
9
11
  """
12
+
13
+ @property
14
+ def display_name(self):
15
+ # type: () -> Optional[str]
16
+ """The human-readable name of the policy."""
17
+ return self.properties.get("displayName", None)
@@ -13,6 +13,9 @@ from office365.directory.policies.cross_tenant_access import CrossTenantAccessPo
13
13
  from office365.directory.policies.device_registration import DeviceRegistrationPolicy
14
14
  from office365.directory.policies.permission_grant import PermissionGrantPolicy
15
15
  from office365.directory.policies.tenant_app_management import TenantAppManagementPolicy
16
+ from office365.directory.policies.unified_role_management import (
17
+ UnifiedRoleManagementPolicy,
18
+ )
16
19
  from office365.entity import Entity
17
20
  from office365.entity_collection import EntityCollection
18
21
  from office365.runtime.paths.resource_path import ResourcePath
@@ -162,6 +165,19 @@ class PolicyRoot(Entity):
162
165
  ),
163
166
  )
164
167
 
168
+ @property
169
+ def role_management_policies(self):
170
+ # type: () -> EntityCollection[UnifiedRoleManagementPolicy]
171
+ """Specifies the various policies associated with scopes and roles."""
172
+ return self.properties.get(
173
+ "roleManagementPolicies",
174
+ EntityCollection(
175
+ self.context,
176
+ UnifiedRoleManagementPolicy,
177
+ ResourcePath("roleManagementPolicies", self.resource_path),
178
+ ),
179
+ )
180
+
165
181
  def get_property(self, name, default_value=None):
166
182
  if default_value is None:
167
183
  property_mapping = {
@@ -176,6 +192,7 @@ class PolicyRoot(Entity):
176
192
  "defaultAppManagementPolicy": self.default_app_management_policy,
177
193
  "deviceRegistrationPolicy": self.device_registration_policy,
178
194
  "permissionGrantPolicies": self.permission_grant_policies,
195
+ "roleManagementPolicies": self.role_management_policies,
179
196
  }
180
197
  default_value = property_mapping.get(name, None)
181
198
  return super(PolicyRoot, self).get_property(name, default_value)
@@ -0,0 +1,7 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class UnifiedRoleManagementPolicy(Entity):
5
+ """Specifies the various policies associated with scopes and roles.
6
+ For policies that apply to Azure RBAC, use the Azure REST PIM API for role management policies.
7
+ """
File without changes
@@ -0,0 +1,24 @@
1
+ from office365.directory.permissions.identity_set import IdentitySet
2
+ from office365.entity import Entity
3
+
4
+
5
+ class ProtectionPolicyBase(Entity):
6
+ """
7
+ Contains details about protection policies applied to Microsoft 365 data in an organization.
8
+ Protection policies are defined by the Global Admin (or the SharePoint Online Admin or Exchange Online Admin)
9
+ and include what data to protect, when to protect it, and for what time period to retain the protected data
10
+ for a single Microsoft 365 service.
11
+ """
12
+
13
+ @property
14
+ def created_by(self):
15
+ """Identity of the user, device, or application which created the item."""
16
+ return self.properties.get("createdBy", IdentitySet())
17
+
18
+ def get_property(self, name, default_value=None):
19
+ if default_value is None:
20
+ property_mapping = {
21
+ "createdBy": self.created_by,
22
+ }
23
+ default_value = property_mapping.get(name, None)
24
+ return super(ProtectionPolicyBase, self).get_property(name, default_value)
@@ -0,0 +1,10 @@
1
+ from office365.directory.protection.policy.base import ProtectionPolicyBase
2
+
3
+
4
+ class OneDriveForBusinessProtectionPolicy(ProtectionPolicyBase):
5
+ """
6
+ Contains details about protection policies applied to Microsoft 365 data in an organization.
7
+ Protection policies are defined by the Global Admin (or the SharePoint Online Admin or Exchange Online Admin)
8
+ and include what data to protect, when to protect it, and for what time period to retain the protected data
9
+ for a single Microsoft 365 service.
10
+ """
@@ -3,3 +3,10 @@ from office365.runtime.client_value import ClientValue
3
3
 
4
4
  class UserSimulationDetails(ClientValue):
5
5
  """Represents a user of a tenant and their online actions in an attack simulation and training campaign."""
6
+
7
+ def __init__(self, assigned_trainings_count=None):
8
+ """
9
+ :param int assigned_trainings_count: Number of trainings assigned to a user in an attack simulation
10
+ and training campaign.
11
+ """
12
+ self.assignedTrainingsCount = assigned_trainings_count
@@ -1,3 +1,4 @@
1
+ from collections.abc import Callable
1
2
  from typing import Optional
2
3
 
3
4
  from typing_extensions import Self
@@ -102,7 +103,8 @@ class ServicePrincipal(DirectoryObject):
102
103
  self.context.add_query(qry)
103
104
  return return_type
104
105
 
105
- def _ensure_client_service_principal(self, app, action):
106
+ def _get_service_principal_by_app(self, app, action):
107
+ # type: (Application|str, Callable[[Application], None]) -> None
106
108
  if isinstance(app, Application):
107
109
 
108
110
  def _after():
@@ -112,6 +114,54 @@ class ServicePrincipal(DirectoryObject):
112
114
  else:
113
115
  self.context.service_principals.get_by_app(app).get().after_execute(action)
114
116
 
117
+ def get_delegated(self, app, principal, scope=None):
118
+ # type: (Application|str, User|str, AppRole|str) -> DeltaCollection[OAuth2PermissionGrant]
119
+ """Gets a delegated permission to the client service principal on behalf of a user"""
120
+
121
+ return_type = DeltaCollection(self.context, OAuth2PermissionGrant)
122
+
123
+ def _get_delegated(col):
124
+ # type: (DeltaCollection[OAuth2PermissionGrant]) -> None
125
+ if scope is None:
126
+ [return_type.add_child(g) for g in col if g.resource_id == self.id]
127
+ else:
128
+ [
129
+ return_type.add_child(g)
130
+ for g in col
131
+ if g.scope == scope and g.resource_id == self.id
132
+ ]
133
+
134
+ def _principal_resolved(principal_id):
135
+ # type: (str) -> None
136
+ def _client_loaded(client):
137
+ # type: (ServicePrincipal) -> None
138
+ query_text = ("principalId eq '{0}' and clientId eq '{1}'").format(
139
+ principal_id, client.id
140
+ )
141
+
142
+ (
143
+ self.context.oauth2_permission_grants.get()
144
+ .filter(query_text)
145
+ .after_execute(_get_delegated)
146
+ )
147
+
148
+ self.context.service_principals.get_by_app(app).get().after_execute(
149
+ _client_loaded
150
+ )
151
+
152
+ def _resource_resolved():
153
+ if isinstance(principal, User):
154
+
155
+ def _after():
156
+ _principal_resolved(principal.id)
157
+
158
+ principal.ensure_property("id", _after)
159
+ else:
160
+ _principal_resolved(principal)
161
+
162
+ self.ensure_property("id", _resource_resolved)
163
+ return return_type
164
+
115
165
  def grant_delegated(self, app, principal, scope):
116
166
  # type: (Application|str, User|str, AppRole|str) -> Self
117
167
  """Grants a delegated permission to the client service principal on behalf of a user"""
@@ -126,30 +176,33 @@ class ServicePrincipal(DirectoryObject):
126
176
  scope=scope,
127
177
  )
128
178
 
129
- def _ensure_app(principal_id):
130
- def _after(return_type):
179
+ def _principal_resolved(principal_id):
180
+ # type: (str) -> None
181
+ def _client_loaded(return_type):
131
182
  _grant_delegated(principal_id, return_type.id)
132
183
 
133
- self._ensure_client_service_principal(app, _after)
184
+ self.context.service_principals.get_by_app(app).get().after_execute(
185
+ _client_loaded
186
+ )
134
187
 
135
- def _ensure_principal():
188
+ def _resource_resolved():
136
189
  if isinstance(principal, User):
137
190
 
138
191
  def _after():
139
- _ensure_app(principal.id)
192
+ _principal_resolved(principal.id)
140
193
 
141
194
  principal.ensure_property("id", _after)
142
195
  else:
143
- _ensure_app(principal)
196
+ _principal_resolved(principal)
144
197
 
145
- self.ensure_property("id", _ensure_principal)
198
+ self.ensure_property("id", _resource_resolved)
146
199
  return self
147
200
 
148
201
  def revoke_delegated(self, app, principal, scope):
149
202
  # type: (Application|str, User|str, AppRole|str) -> Self
150
203
  """"""
151
204
 
152
- def _revoke(app_id, principal_id):
205
+ def _revoke_delegated(app_id, principal_id):
153
206
  # type: (str, str) -> None
154
207
 
155
208
  def _after(return_type):
@@ -158,7 +211,6 @@ class ServicePrincipal(DirectoryObject):
158
211
  query_text = "clientId eq '{0}' and principalId eq '{1}'".format(
159
212
  app_id, principal_id
160
213
  )
161
- # query_text = "clientId eq '{0}'".format(app_id)
162
214
  self.context.oauth2_permission_grants.filter(
163
215
  query_text
164
216
  ).get().after_execute(_after)
@@ -167,14 +219,13 @@ class ServicePrincipal(DirectoryObject):
167
219
  if isinstance(principal, User):
168
220
 
169
221
  def _after():
170
- _revoke(principal.id, return_type.id)
222
+ _revoke_delegated(principal.id, return_type.id)
171
223
 
172
224
  principal.ensure_property("id", _after)
173
225
  else:
174
- _revoke(principal, return_type.id)
226
+ _revoke_delegated(principal, return_type.id)
175
227
 
176
- self._ensure_client_service_principal(app, _ensure_principal)
177
- # self.ensure_property("id", _ensure_principal)
228
+ self._get_service_principal_by_app(app, _ensure_principal)
178
229
  return self
179
230
 
180
231
  def grant_application(self, app, app_role):
@@ -193,6 +193,16 @@ class User(DirectoryObject):
193
193
  self.context.add_query(qry)
194
194
  return return_type
195
195
 
196
+ def get_my_site(self):
197
+ """Gets user's site"""
198
+ return_type = Site(self.context)
199
+
200
+ def _loaded():
201
+ return_type.set_property("webUrl", self.my_site)
202
+
203
+ self.ensure_property("mySite", _loaded)
204
+ return return_type
205
+
196
206
  def send_mail(
197
207
  self,
198
208
  subject,
@@ -535,11 +545,21 @@ class User(DirectoryObject):
535
545
  @property
536
546
  def given_name(self):
537
547
  # type: () -> Optional[str]
538
- """
539
- The given name (first name) of the user. Maximum length is 64 characters.
540
- """
548
+ """The given name (first name) of the user. Maximum length is 64 characters"""
541
549
  return self.properties.get("givenName", None)
542
550
 
551
+ @property
552
+ def my_site(self):
553
+ # type: () -> Optional[str]
554
+ """The URL for the user's site."""
555
+ return self.properties.get("mySite", None)
556
+
557
+ @property
558
+ def office_location(self):
559
+ # type: () -> Optional[str]
560
+ """The office location in the user's place of business."""
561
+ return self.properties.get("officeLocation", None)
562
+
543
563
  @property
544
564
  def user_principal_name(self):
545
565
  # type: () -> Optional[str]
office365/graph_client.py CHANGED
@@ -229,9 +229,11 @@ class GraphClient(ClientRuntimeContext):
229
229
 
230
230
  return GraphClient(_acquire_token)
231
231
 
232
- def execute_batch(self, items_per_batch=100, success_callback=None):
232
+ def execute_batch(self, items_per_batch=20, success_callback=None):
233
233
  """Constructs and submit a batch request
234
234
 
235
+ Per Batch size limitations: JSON batch requests are currently limited to 20 individual requests.
236
+
235
237
  :param int items_per_batch: Maximum to be selected for bulk operation
236
238
  :param (List[ClientObject|ClientResult])-> None success_callback: A success callback
237
239
  """
@@ -9,6 +9,8 @@ from office365.intune.devices.enrollment.configuration import (
9
9
  )
10
10
  from office365.intune.devices.managed import ManagedDevice
11
11
  from office365.intune.devices.management.reports.reports import DeviceManagementReports
12
+ from office365.intune.devices.management.terms_and_conditions import TermsAndConditions
13
+ from office365.intune.devices.management.virtual_endpoint import VirtualEndpoint
12
14
  from office365.runtime.client_result import ClientResult
13
15
  from office365.runtime.client_value_collection import ClientValueCollection
14
16
  from office365.runtime.paths.resource_path import ResourcePath
@@ -40,6 +42,28 @@ class DeviceManagement(Entity):
40
42
  ),
41
43
  )
42
44
 
45
+ @property
46
+ def virtual_endpoint(self):
47
+ """"""
48
+ return self.properties.get(
49
+ "virtualEndpoint",
50
+ VirtualEndpoint(
51
+ self.context, ResourcePath("virtualEndpoint", self.resource_path)
52
+ ),
53
+ )
54
+
55
+ @property
56
+ def terms_and_conditions(self):
57
+ """"""
58
+ return self.properties.get(
59
+ "termsAndConditions",
60
+ EntityCollection(
61
+ self.context,
62
+ TermsAndConditions,
63
+ ResourcePath("termsAndConditions", self.resource_path),
64
+ ),
65
+ )
66
+
43
67
  @property
44
68
  def device_categories(self):
45
69
  """"""
@@ -98,6 +122,8 @@ class DeviceManagement(Entity):
98
122
  "deviceEnrollmentConfigurations": self.device_enrollment_configurations,
99
123
  "intuneBrand": self.intune_brand,
100
124
  "managedDevices": self.managed_devices,
125
+ "termsAndConditions": self.terms_and_conditions,
126
+ "virtualEndpoint": self.virtual_endpoint,
101
127
  }
102
128
  default_value = property_mapping.get(name, None)
103
129
  return super(DeviceManagement, self).get_property(name, default_value)
@@ -0,0 +1,10 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class TermsAndConditions(Entity):
5
+ """
6
+ A termsAndConditions entity represents the metadata and contents of a given Terms and Conditions (T&C) policy.
7
+ T&C policies’ contents are presented to users upon their first attempt to enroll into Intune and subsequently
8
+ upon edits where an administrator has required re-acceptance. They enable administrators to communicate
9
+ the provisions to which a user must agree in order to have devices enrolled into Intune.
10
+ """
@@ -0,0 +1,8 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class VirtualEndpoint(Entity):
5
+ """
6
+ Use the Cloud PC API to provision and manage virtual desktops for employees in an organization,
7
+ or along with the Intune API to manage physical and virtual endpoints.
8
+ """
@@ -6,6 +6,7 @@ from typing import TYPE_CHECKING, Any, Callable, Generic, List, Optional, TypeVa
6
6
  from requests import Response
7
7
  from typing_extensions import Self
8
8
 
9
+ from office365.runtime.client_request_exception import ClientRequestException
9
10
  from office365.runtime.client_runtime_context import ClientRuntimeContext
10
11
  from office365.runtime.client_value import ClientValue
11
12
  from office365.runtime.http.request_options import RequestOptions
@@ -55,7 +56,12 @@ class ClientObject(Generic[T]):
55
56
  return self
56
57
 
57
58
  def execute_query_retry(
58
- self, max_retry=5, timeout_secs=5, success_callback=None, failure_callback=None
59
+ self,
60
+ max_retry=5,
61
+ timeout_secs=5,
62
+ success_callback=None,
63
+ failure_callback=None,
64
+ exceptions=(ClientRequestException,),
59
65
  ):
60
66
  """
61
67
  Executes the current set of data retrieval queries and method invocations and retries it if needed.
@@ -66,12 +72,14 @@ class ClientObject(Generic[T]):
66
72
  if the request executes successfully.
67
73
  :param (int, requests.exceptions.RequestException)-> None failure_callback: A callback to call if the request
68
74
  fails to execute
75
+ :param exceptions: tuple of exceptions that we retry
69
76
  """
70
77
  self.context.execute_query_retry(
71
78
  max_retry=max_retry,
72
79
  timeout_secs=timeout_secs,
73
80
  success_callback=success_callback,
74
81
  failure_callback=failure_callback,
82
+ exceptions=exceptions,
75
83
  )
76
84
  return self
77
85
 
@@ -138,7 +138,7 @@ class ClientObjectCollection(ClientObject, Generic[T]):
138
138
  return self
139
139
 
140
140
  def paged(self, page_size=None, page_loaded=None):
141
- # type: (int, Callable[[Self], None]) -> Self
141
+ # type: (int, Callable[[Self], None] | None) -> Self
142
142
  """Retrieves via server-driven paging mode"""
143
143
  self._paged_mode = True
144
144
  if callable(page_loaded):
@@ -158,7 +158,7 @@ class ClientObjectCollection(ClientObject, Generic[T]):
158
158
  return self
159
159
 
160
160
  def get_all(self, page_size=None, page_loaded=None):
161
- # type: (int, Callable[[Self], None]) -> Self
161
+ # type: (int, Callable[[Self], None] | None) -> Self
162
162
  """Gets all the items in a collection, regardless of the size."""
163
163
 
164
164
  def _page_loaded(col):
@@ -3,6 +3,7 @@ from typing import TYPE_CHECKING, Callable, Generic, Optional, TypeVar
3
3
 
4
4
  from typing_extensions import Self
5
5
 
6
+ from office365.runtime.client_request_exception import ClientRequestException
6
7
  from office365.runtime.http.request_options import RequestOptions
7
8
 
8
9
  if TYPE_CHECKING:
@@ -54,13 +55,29 @@ class ClientResult(Generic[T]):
54
55
  return self
55
56
 
56
57
  def execute_query_retry(
57
- self, max_retry=5, timeout_secs=5, success_callback=None, failure_callback=None
58
+ self,
59
+ max_retry=5,
60
+ timeout_secs=5,
61
+ success_callback=None,
62
+ failure_callback=None,
63
+ exceptions=(ClientRequestException,),
58
64
  ):
59
- """Executes the current set of data retrieval queries and method invocations and retries it if needed."""
65
+ """
66
+ Executes the current set of data retrieval queries and method invocations and retries it if needed.
67
+
68
+ :param int max_retry: Number of times to retry the request
69
+ :param int timeout_secs: Seconds to wait before retrying the request.
70
+ :param (office365.runtime.client_object.ClientObject)-> None success_callback: A callback to call
71
+ if the request executes successfully.
72
+ :param (int, requests.exceptions.RequestException)-> None failure_callback: A callback to call if the request
73
+ fails to execute
74
+ :param exceptions: tuple of exceptions that we retry
75
+ """
60
76
  self._context.execute_query_retry(
61
77
  max_retry=max_retry,
62
78
  timeout_secs=timeout_secs,
63
79
  success_callback=success_callback,
64
80
  failure_callback=failure_callback,
81
+ exceptions=exceptions,
65
82
  )
66
83
  return self
@@ -46,11 +46,8 @@ class ODataV4BatchRequest(ODataRequest):
46
46
  yield qry, resp
47
47
 
48
48
  def _prepare_payload(self, query):
49
- """
50
- Serializes a batch request body.
51
-
52
- :type query: office365.runtime.queries.batch.BatchQuery
53
- """
49
+ # type: (BatchQuery) -> Dict
50
+ """Serializes a batch request body."""
54
51
  requests_json = []
55
52
  for qry in query.queries:
56
53
  qry_id = str(len(requests_json))
@@ -63,16 +60,16 @@ class ODataV4BatchRequest(ODataRequest):
63
60
  # type: (ClientQuery, str, Optional[List[str]]) -> Dict[str, Any]
64
61
  """ """
65
62
  request = query.build_request()
66
- allowed_props = ["id", "method", "headers", "url", "body"]
67
- request_json = dict(
68
- (k, v)
69
- for k, v in vars(request).items()
70
- if v is not None and k in allowed_props
71
- )
72
- request_json["id"] = query_id
63
+
64
+ request_json = {
65
+ "id": query_id,
66
+ "url": request.url.replace(query.context.service_root_url(), ""),
67
+ "method": request.method,
68
+ "headers": request.headers,
69
+ }
70
+ if request.data:
71
+ request_json["body"] = request.data
72
+
73
73
  if depends_on is not None:
74
74
  request_json["dependsOn"] = depends_on
75
- request_json["url"] = request_json["url"].replace(
76
- query.context.service_root_url(), ""
77
- )
78
75
  return request_json
@@ -0,0 +1,41 @@
1
+ from office365.onedrive.sites.site import Site
2
+ from office365.runtime.paths.resource_path import ResourcePath
3
+ from office365.runtime.paths.service_operation import ServiceOperationPath
4
+ from office365.sharepoint.client_context import ClientContext
5
+ from office365.sharepoint.entity import Entity
6
+ from office365.sharepoint.webs.web import Web
7
+
8
+
9
+ class AppContextSite(Entity):
10
+ """ """
11
+
12
+ def __init__(self, context, site_url):
13
+ # type: (ClientContext, str) -> None
14
+ """"""
15
+ static_path = ServiceOperationPath(
16
+ "SP.AppContextSite",
17
+ {"siteUrl": site_url},
18
+ )
19
+ super(AppContextSite, self).__init__(context, static_path)
20
+
21
+ @property
22
+ def site(self):
23
+ """"""
24
+ return self.properties.get(
25
+ "Site",
26
+ Site(
27
+ self.context,
28
+ ResourcePath("Site", self.resource_path),
29
+ ),
30
+ )
31
+
32
+ @property
33
+ def web(self):
34
+ """"""
35
+ return self.properties.get(
36
+ "Web",
37
+ Web(
38
+ self.context,
39
+ ResourcePath("Web", self.resource_path),
40
+ ),
41
+ )
@@ -0,0 +1,11 @@
1
+ from office365.sharepoint.authpolicy.events.event import SPAuthEvent
2
+ from office365.sharepoint.entity_collection import EntityCollection
3
+
4
+
5
+ class SPAuthEventCollection(EntityCollection[SPAuthEvent]):
6
+ """Represents a collection of Field resource."""
7
+
8
+ def __init__(self, context, resource_path=None, parent=None):
9
+ super(SPAuthEventCollection, self).__init__(
10
+ context, SPAuthEvent, resource_path, parent
11
+ )