Office365-REST-Python-Client 2.5.9__py3-none-any.whl → 2.5.11__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.
- {Office365_REST_Python_Client-2.5.9.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/METADATA +9 -10
- {Office365_REST_Python_Client-2.5.9.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/RECORD +82 -70
- {Office365_REST_Python_Client-2.5.9.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/WHEEL +1 -1
- office365/directory/identitygovernance/appconsent/request.py +32 -0
- office365/directory/identitygovernance/appconsent/request_scope.py +5 -0
- office365/directory/identitygovernance/privilegedaccess/group.py +5 -0
- office365/directory/identitygovernance/privilegedaccess/root.py +14 -0
- office365/directory/identitygovernance/privilegedaccess/schedule_instance.py +6 -0
- office365/directory/policies/admin_consent_request.py +10 -0
- office365/directory/policies/root.py +15 -0
- office365/directory/synchronization/status.py +14 -1
- office365/directory/synchronization/task_execution.py +5 -0
- office365/directory/users/user.py +4 -2
- office365/graph_client.py +7 -24
- office365/graph_request.py +24 -1
- office365/onedrive/driveitems/driveItem.py +41 -38
- office365/onedrive/internal/paths/url.py +14 -0
- office365/onedrive/listitems/list_item.py +1 -0
- office365/onedrive/lists/collection.py +6 -0
- office365/onedrive/sharepoint_ids.py +18 -1
- office365/onedrive/shares/drive_item.py +1 -2
- office365/onedrive/sitepages/horizontal_section_column.py +1 -1
- office365/onedrive/sitepages/site_page.py +1 -1
- office365/onedrive/sitepages/vertical_section.py +1 -1
- office365/onedrive/sitepages/webparts/__init__.py +0 -0
- office365/onedrive/sitepages/webparts/standard.py +5 -0
- office365/onedrive/sitepages/webparts/text.py +5 -0
- office365/onedrive/storage/__init__.py +0 -0
- office365/onedrive/storage/storage.py +5 -0
- office365/onedrive/workbooks/filter.py +7 -0
- office365/onedrive/workbooks/filter_criteria.py +9 -2
- office365/onedrive/workbooks/tables/rows/collection.py +20 -0
- office365/onedrive/workbooks/tables/rows/row.py +2 -1
- office365/onedrive/workbooks/workbook.py +7 -5
- office365/onenote/internal/multipart_page_query.py +2 -3
- office365/outlook/category.py +7 -0
- office365/outlook/mail/item_body.py +10 -1
- office365/outlook/mail/messages/collection.py +3 -0
- office365/outlook/mail/messages/message.py +3 -4
- office365/runtime/auth/providers/saml_token_provider.py +4 -4
- office365/runtime/client_object.py +4 -3
- office365/runtime/client_request.py +1 -1
- office365/runtime/client_runtime_context.py +3 -3
- office365/runtime/http/request_options.py +7 -3
- office365/runtime/paths/resource_path.py +3 -0
- office365/runtime/queries/create_entity.py +6 -8
- office365/runtime/queries/update_entity.py +3 -5
- office365/sharepoint/attachments/attachment.py +14 -2
- office365/sharepoint/attachments/collection.py +27 -4
- office365/sharepoint/businessdata/infrastructure/securestore/connection_settings.py +23 -1
- office365/sharepoint/changes/app_consent_principal.py +5 -0
- office365/sharepoint/changes/file.py +4 -0
- office365/sharepoint/directory/membership_result.py +5 -0
- office365/sharepoint/documentmanagement/document_set.py +7 -8
- office365/sharepoint/entity.py +5 -0
- office365/sharepoint/fields/builtin_field_id.py +19 -0
- office365/sharepoint/fields/choice.py +2 -2
- office365/sharepoint/fields/collection.py +1 -3
- office365/sharepoint/fields/field.py +5 -2
- office365/sharepoint/files/file.py +1 -1
- office365/sharepoint/internal/queries/upload_file.py +12 -8
- office365/sharepoint/lists/list.py +3 -2
- office365/sharepoint/navigation/node.py +4 -2
- office365/sharepoint/packaging/app_details.py +34 -0
- office365/sharepoint/policy/dlp_policy_tip.py +9 -1
- office365/sharepoint/portal/sites/manager.py +1 -1
- office365/sharepoint/principal/principal.py +10 -1
- office365/sharepoint/principal/users/collection.py +1 -3
- office365/sharepoint/publishing/sites/communication/site.py +4 -3
- office365/sharepoint/request.py +33 -1
- office365/sharepoint/search/service.py +5 -3
- office365/sharepoint/sharing/information.py +5 -0
- office365/sharepoint/sharing/permission_collection.py +13 -9
- office365/sharepoint/sharing/recipient_limits.py +9 -0
- office365/sharepoint/sharing/site_sharing_report_helper.py +2 -3
- office365/sharepoint/tenant/administration/tenant.py +22 -0
- office365/sharepoint/tenant/management/office365_tenant.py +18 -0
- office365/sharepoint/userprofiles/profile_loader.py +1 -3
- office365/sharepoint/userprofiles/user_profile.py +80 -6
- {Office365_REST_Python_Client-2.5.9.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.9.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/top_level.txt +0 -0
- /office365/onedrive/sitepages/{web_part.py → webparts/web_part.py} +0 -0
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from office365.directory.identitygovernance.appconsent.request_scope import (
|
|
4
|
+
AppConsentRequestScope,
|
|
5
|
+
)
|
|
1
6
|
from office365.directory.identitygovernance.userconsent.request_collection import (
|
|
2
7
|
UserConsentRequestCollection,
|
|
3
8
|
)
|
|
4
9
|
from office365.entity import Entity
|
|
10
|
+
from office365.runtime.client_value_collection import ClientValueCollection
|
|
5
11
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
6
12
|
|
|
7
13
|
|
|
@@ -15,6 +21,32 @@ class AppConsentRequest(Entity):
|
|
|
15
21
|
the admin consent workflow is enabled.
|
|
16
22
|
"""
|
|
17
23
|
|
|
24
|
+
def __str__(self):
|
|
25
|
+
return self.app_display_name or self.entity_type_name
|
|
26
|
+
|
|
27
|
+
def __repr__(self):
|
|
28
|
+
return self.app_id or self.entity_type_name
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def app_display_name(self):
|
|
32
|
+
# type: () -> Optional[str]
|
|
33
|
+
"""Display name of the application object on which this extension property is defined. Read-only"""
|
|
34
|
+
return self.properties.get("appDisplayName", None)
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def app_id(self):
|
|
38
|
+
# type: () -> Optional[str]
|
|
39
|
+
"""The identifier of the application"""
|
|
40
|
+
return self.properties.get("appId", None)
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def pending_scopes(self):
|
|
44
|
+
# type: () -> ClientValueCollection[AppConsentRequestScope]
|
|
45
|
+
"""A list of pending scopes waiting for approval. Required."""
|
|
46
|
+
return self.properties.get(
|
|
47
|
+
"pendingScopes", ClientValueCollection(AppConsentRequestScope)
|
|
48
|
+
)
|
|
49
|
+
|
|
18
50
|
@property
|
|
19
51
|
def user_consent_requests(self):
|
|
20
52
|
"""A list of pending user consent requests."""
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
from office365.directory.identitygovernance.privilegedaccess.group import (
|
|
2
|
+
PrivilegedAccessGroup,
|
|
3
|
+
)
|
|
1
4
|
from office365.entity import Entity
|
|
5
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
2
6
|
|
|
3
7
|
|
|
4
8
|
class PrivilegedAccessRoot(Entity):
|
|
5
9
|
"""Represents the entry point for resources related to Privileged Identity Management (PIM)."""
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
def group(self):
|
|
13
|
+
"""A list of pending user consent requests."""
|
|
14
|
+
return self.properties.get(
|
|
15
|
+
"group",
|
|
16
|
+
PrivilegedAccessGroup(
|
|
17
|
+
self.context, ResourcePath("group", self.resource_path)
|
|
18
|
+
),
|
|
19
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AdminConsentRequestPolicy(Entity):
|
|
5
|
+
"""
|
|
6
|
+
Represents the policy for enabling or disabling the Microsoft Entra admin consent workflow.
|
|
7
|
+
The admin consent workflow allows users to request access for apps that they wish to use and that require admin
|
|
8
|
+
authorization before users can use the apps to access organizational data.
|
|
9
|
+
There is a single adminConsentRequestPolicy per tenant.
|
|
10
|
+
"""
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from office365.directory.policies.admin_consent_request import AdminConsentRequestPolicy
|
|
1
2
|
from office365.directory.policies.app_management import AppManagementPolicy
|
|
2
3
|
from office365.directory.policies.authentication_flows import AuthenticationFlowsPolicy
|
|
3
4
|
from office365.directory.policies.authentication_methods import (
|
|
@@ -20,6 +21,19 @@ from office365.runtime.paths.resource_path import ResourcePath
|
|
|
20
21
|
class PolicyRoot(Entity):
|
|
21
22
|
"""Resource type exposing navigation properties for the policies singleton."""
|
|
22
23
|
|
|
24
|
+
@property
|
|
25
|
+
def admin_consent_request_policy(self):
|
|
26
|
+
"""
|
|
27
|
+
The policy by which consent requests are created and managed for the entire tenant.
|
|
28
|
+
"""
|
|
29
|
+
return self.properties.get(
|
|
30
|
+
"adminConsentRequestPolicy",
|
|
31
|
+
AdminConsentRequestPolicy(
|
|
32
|
+
self.context,
|
|
33
|
+
ResourcePath("adminConsentRequestPolicy", self.resource_path),
|
|
34
|
+
),
|
|
35
|
+
)
|
|
36
|
+
|
|
23
37
|
@property
|
|
24
38
|
def authentication_methods_policy(self):
|
|
25
39
|
"""
|
|
@@ -151,6 +165,7 @@ class PolicyRoot(Entity):
|
|
|
151
165
|
def get_property(self, name, default_value=None):
|
|
152
166
|
if default_value is None:
|
|
153
167
|
property_mapping = {
|
|
168
|
+
"adminConsentRequestPolicy": self.admin_consent_request_policy,
|
|
154
169
|
"authenticationStrengthPolicies": self.authentication_strength_policies,
|
|
155
170
|
"authenticationFlowsPolicy": self.authentication_flows_policy,
|
|
156
171
|
"appManagementPolicies": self.app_management_policies,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from office365.directory.synchronization.progress import SynchronizationProgress
|
|
2
2
|
from office365.directory.synchronization.quarantine import SynchronizationQuarantine
|
|
3
|
+
from office365.directory.synchronization.task_execution import (
|
|
4
|
+
SynchronizationTaskExecution,
|
|
5
|
+
)
|
|
3
6
|
from office365.runtime.client_value import ClientValue
|
|
4
7
|
from office365.runtime.client_value_collection import ClientValueCollection
|
|
5
8
|
|
|
@@ -7,10 +10,20 @@ from office365.runtime.client_value_collection import ClientValueCollection
|
|
|
7
10
|
class SynchronizationStatus(ClientValue):
|
|
8
11
|
"""Represents the current status of the synchronizationJob."""
|
|
9
12
|
|
|
10
|
-
def __init__(
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
progress=None,
|
|
16
|
+
quarantine=SynchronizationQuarantine(),
|
|
17
|
+
last_execution=SynchronizationTaskExecution(),
|
|
18
|
+
last_successful_execution=SynchronizationTaskExecution(),
|
|
19
|
+
last_successful_execution_with_exports=SynchronizationTaskExecution(),
|
|
20
|
+
):
|
|
11
21
|
"""
|
|
12
22
|
:param list[SynchronizationProgress] progress: Details of the progress of a job toward completion.
|
|
13
23
|
:param SynchronizationQuarantine quarantine:
|
|
14
24
|
"""
|
|
15
25
|
self.progress = ClientValueCollection(SynchronizationProgress, progress)
|
|
16
26
|
self.quarantine = quarantine
|
|
27
|
+
self.lastExecution = last_execution
|
|
28
|
+
self.lastSuccessfulExecution = last_successful_execution
|
|
29
|
+
self.lastSuccessfulExecutionWithExports = last_successful_execution_with_exports
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from datetime import datetime
|
|
3
|
-
from typing import Optional
|
|
3
|
+
from typing import List, Optional
|
|
4
4
|
|
|
5
5
|
from office365.communications.onlinemeetings.collection import OnlineMeetingCollection
|
|
6
6
|
from office365.communications.presences.presence import Presence
|
|
@@ -46,6 +46,7 @@ from office365.outlook.contacts.collection import ContactCollection
|
|
|
46
46
|
from office365.outlook.contacts.folder import ContactFolder
|
|
47
47
|
from office365.outlook.convert_id_result import ConvertIdResult
|
|
48
48
|
from office365.outlook.mail.folders.collection import MailFolderCollection
|
|
49
|
+
from office365.outlook.mail.item_body import ItemBody
|
|
49
50
|
from office365.outlook.mail.mailbox_settings import MailboxSettings
|
|
50
51
|
from office365.outlook.mail.messages.collection import MessageCollection
|
|
51
52
|
from office365.outlook.mail.messages.message import Message
|
|
@@ -201,6 +202,7 @@ class User(DirectoryObject):
|
|
|
201
202
|
bcc_recipients=None,
|
|
202
203
|
save_to_sent_items=False,
|
|
203
204
|
):
|
|
205
|
+
# type: (str, str|ItemBody, List[str], List[str], List[str], bool) -> Message
|
|
204
206
|
"""Send a new message on the fly
|
|
205
207
|
|
|
206
208
|
:param str subject: The subject of the message.
|
|
@@ -347,7 +349,7 @@ class User(DirectoryObject):
|
|
|
347
349
|
start_dt.isoformat(), end_dt.isoformat()
|
|
348
350
|
)
|
|
349
351
|
|
|
350
|
-
self.context.add_query(qry).
|
|
352
|
+
self.context.add_query(qry).before_query_execute(_construct_request)
|
|
351
353
|
return return_type
|
|
352
354
|
|
|
353
355
|
def get_reminder_view(self, start_dt, end_dt):
|
office365/graph_client.py
CHANGED
|
@@ -41,6 +41,7 @@ from office365.directory.users.collection import UserCollection
|
|
|
41
41
|
from office365.directory.users.user import User
|
|
42
42
|
from office365.education.root import EducationRoot
|
|
43
43
|
from office365.entity_collection import EntityCollection
|
|
44
|
+
from office365.graph_request import GraphRequest
|
|
44
45
|
from office365.intune.devices.app_management import DeviceAppManagement
|
|
45
46
|
from office365.intune.devices.collection import DeviceCollection
|
|
46
47
|
from office365.intune.devices.management.management import DeviceManagement
|
|
@@ -58,7 +59,6 @@ from office365.runtime.auth.token_response import TokenResponse
|
|
|
58
59
|
from office365.runtime.client_runtime_context import ClientRuntimeContext
|
|
59
60
|
from office365.runtime.http.http_method import HttpMethod
|
|
60
61
|
from office365.runtime.http.request_options import RequestOptions
|
|
61
|
-
from office365.runtime.odata.request import ODataRequest
|
|
62
62
|
from office365.runtime.odata.v4.batch_request import ODataV4BatchRequest
|
|
63
63
|
from office365.runtime.odata.v4.json_format import V4JsonFormat
|
|
64
64
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
@@ -73,31 +73,14 @@ from office365.teams.collection import TeamCollection
|
|
|
73
73
|
from office365.teams.template import TeamsTemplate
|
|
74
74
|
from office365.teams.viva.employee_experience import EmployeeExperience
|
|
75
75
|
|
|
76
|
-
environments_endpoints = {
|
|
77
|
-
"GCCH": {
|
|
78
|
-
"graph_url": "https://graph.microsoft.com",
|
|
79
|
-
"entra_url": "https://login.microsoftonline.com",
|
|
80
|
-
},
|
|
81
|
-
"GCC High": {
|
|
82
|
-
"graph_url": "https://graph.microsoft.us",
|
|
83
|
-
"entra_url": "https://login.microsoftonline.us",
|
|
84
|
-
},
|
|
85
|
-
"DoD": {
|
|
86
|
-
"graph_url": "https://dod-graph.microsoft.us",
|
|
87
|
-
"entra_url": "https://login.chinacloudapi.cn",
|
|
88
|
-
},
|
|
89
|
-
}
|
|
90
|
-
|
|
91
76
|
|
|
92
77
|
class GraphClient(ClientRuntimeContext):
|
|
93
78
|
"""Graph Service client"""
|
|
94
79
|
|
|
95
|
-
def __init__(self, acquire_token_callback
|
|
96
|
-
# type: (Callable[[], dict]
|
|
80
|
+
def __init__(self, acquire_token_callback):
|
|
81
|
+
# type: (Callable[[], dict]) -> None
|
|
97
82
|
super(GraphClient, self).__init__()
|
|
98
83
|
self._pending_request = None
|
|
99
|
-
self._version = version
|
|
100
|
-
self._environment_endpoints = environments_endpoints.get(environment, None)
|
|
101
84
|
self._acquire_token_callback = acquire_token_callback
|
|
102
85
|
|
|
103
86
|
@staticmethod
|
|
@@ -127,7 +110,7 @@ class GraphClient(ClientRuntimeContext):
|
|
|
127
110
|
"thumbprint": thumbprint,
|
|
128
111
|
"private_key": private_key,
|
|
129
112
|
},
|
|
130
|
-
token_cache=token_cache # Default cache is in memory only.
|
|
113
|
+
token_cache=token_cache, # Default cache is in memory only.
|
|
131
114
|
# You can learn how to use SerializableTokenCache from
|
|
132
115
|
# https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache
|
|
133
116
|
)
|
|
@@ -259,16 +242,16 @@ class GraphClient(ClientRuntimeContext):
|
|
|
259
242
|
return self
|
|
260
243
|
|
|
261
244
|
def pending_request(self):
|
|
262
|
-
# type: () ->
|
|
245
|
+
# type: () -> GraphRequest
|
|
263
246
|
if self._pending_request is None:
|
|
264
|
-
self._pending_request =
|
|
247
|
+
self._pending_request = GraphRequest()
|
|
265
248
|
self._pending_request.beforeExecute += self._authenticate_request
|
|
266
249
|
self._pending_request.beforeExecute += self._build_specific_query
|
|
267
250
|
return self._pending_request
|
|
268
251
|
|
|
269
252
|
def service_root_url(self):
|
|
270
253
|
# type: () -> str
|
|
271
|
-
return
|
|
254
|
+
return self.pending_request().service_root_url
|
|
272
255
|
|
|
273
256
|
def _build_specific_query(self, request):
|
|
274
257
|
# type: (RequestOptions) -> None
|
office365/graph_request.py
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
from office365.runtime.odata.request import ODataRequest
|
|
2
2
|
from office365.runtime.odata.v4.json_format import V4JsonFormat
|
|
3
3
|
|
|
4
|
+
environments_endpoints = {
|
|
5
|
+
"GCCH": {
|
|
6
|
+
"graph_url": "https://graph.microsoft.com",
|
|
7
|
+
"entra_url": "https://login.microsoftonline.com",
|
|
8
|
+
},
|
|
9
|
+
"GCC High": {
|
|
10
|
+
"graph_url": "https://graph.microsoft.us",
|
|
11
|
+
"entra_url": "https://login.microsoftonline.us",
|
|
12
|
+
},
|
|
13
|
+
"DoD": {
|
|
14
|
+
"graph_url": "https://dod-graph.microsoft.us",
|
|
15
|
+
"entra_url": "https://login.chinacloudapi.cn",
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
|
|
4
19
|
|
|
5
20
|
class GraphRequest(ODataRequest):
|
|
6
|
-
def __init__(self):
|
|
21
|
+
def __init__(self, version="v1.0", environment="GCCH"):
|
|
22
|
+
# type: (str, str) -> None
|
|
7
23
|
super(GraphRequest, self).__init__(V4JsonFormat())
|
|
24
|
+
self._version = version
|
|
25
|
+
self._environment_endpoints = environments_endpoints.get(environment, None)
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def service_root_url(self):
|
|
29
|
+
# type: () -> str
|
|
30
|
+
return "https://graph.microsoft.com/{0}".format(self._version)
|
|
@@ -469,6 +469,7 @@ class DriveItem(BaseItem):
|
|
|
469
469
|
return self.get_content(format_name)
|
|
470
470
|
|
|
471
471
|
def copy(self, name=None, parent=None, conflict_behavior=ConflictBehavior.Fail):
|
|
472
|
+
# type: (str, ItemReference|"DriveItem", str) -> ClientResult[str]
|
|
472
473
|
"""Asynchronously creates a copy of an driveItem (including any children), under a new parent item or with a
|
|
473
474
|
new name.
|
|
474
475
|
|
|
@@ -480,32 +481,30 @@ class DriveItem(BaseItem):
|
|
|
480
481
|
|
|
481
482
|
Returns location for details about how to monitor the progress of the copy, upon accepting the request.
|
|
482
483
|
"""
|
|
483
|
-
return_type = ClientResult(self.context
|
|
484
|
+
return_type = ClientResult(self.context, str())
|
|
484
485
|
|
|
485
|
-
def
|
|
486
|
-
# type: (
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
486
|
+
def _copy(parent_reference):
|
|
487
|
+
# type: (ItemReference) -> None
|
|
488
|
+
|
|
489
|
+
def _create_request(request):
|
|
490
|
+
# type: (RequestOptions) -> None
|
|
491
|
+
request.url += "?@microsoft.graph.conflictBehavior={0}".format(
|
|
492
|
+
conflict_behavior
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
def _process_response(resp):
|
|
496
|
+
# type: (requests.Response) -> None
|
|
497
|
+
resp.raise_for_status()
|
|
498
|
+
location = resp.headers.get("Location", None)
|
|
499
|
+
if location is None:
|
|
500
|
+
return
|
|
501
|
+
return_type.set_property("__value", location)
|
|
490
502
|
|
|
491
|
-
def _process_response(resp):
|
|
492
|
-
# type: (requests.Response) -> None
|
|
493
|
-
resp.raise_for_status()
|
|
494
|
-
location = resp.headers.get("Location", None)
|
|
495
|
-
if location is None:
|
|
496
|
-
return
|
|
497
|
-
return_type.set_property("__value", location)
|
|
498
|
-
|
|
499
|
-
def _create_and_add_query(parent_reference):
|
|
500
|
-
"""
|
|
501
|
-
:param office365.onedrive.listitems.item_reference.ItemReference or None parent_reference: Reference to the
|
|
502
|
-
parent item the copy will be created in.
|
|
503
|
-
"""
|
|
504
503
|
payload = {"name": name, "parentReference": parent_reference}
|
|
505
|
-
self.context.before_execute(_create_request)
|
|
506
|
-
self.context.after_execute(_process_response)
|
|
507
504
|
qry = ServiceOperationQuery(self, "copy", None, payload, None, return_type)
|
|
508
|
-
self.context.add_query(qry)
|
|
505
|
+
self.context.add_query(qry).before_query_execute(
|
|
506
|
+
_create_request
|
|
507
|
+
).after_execute(_process_response)
|
|
509
508
|
|
|
510
509
|
if isinstance(parent, DriveItem):
|
|
511
510
|
|
|
@@ -513,14 +512,15 @@ class DriveItem(BaseItem):
|
|
|
513
512
|
parent_reference = ItemReference(
|
|
514
513
|
drive_id=parent.parent_reference.driveId, _id=parent.id
|
|
515
514
|
)
|
|
516
|
-
|
|
515
|
+
_copy(parent_reference)
|
|
517
516
|
|
|
518
517
|
parent.ensure_property("parentReference", _drive_item_loaded)
|
|
519
518
|
else:
|
|
520
|
-
|
|
519
|
+
_copy(parent)
|
|
521
520
|
return return_type
|
|
522
521
|
|
|
523
|
-
def move(self, name=None, parent=None):
|
|
522
|
+
def move(self, name=None, parent=None, conflict_behavior=ConflictBehavior.Fail):
|
|
523
|
+
# type: (str, ItemReference|"DriveItem", str) -> "DriveItem"
|
|
524
524
|
"""To move a DriveItem to a new parent item, your app requests to update the parentReference of the DriveItem
|
|
525
525
|
to move.
|
|
526
526
|
|
|
@@ -528,29 +528,34 @@ class DriveItem(BaseItem):
|
|
|
528
528
|
original.
|
|
529
529
|
:param ItemReference or DriveItem or None parent: Reference to the
|
|
530
530
|
parent item the move will be created in.
|
|
531
|
+
:param str conflict_behavior: query parameter to customize the behavior when a conflict occurs.
|
|
531
532
|
"""
|
|
532
533
|
|
|
533
|
-
return_type =
|
|
534
|
+
return_type = DriveItem(self.context)
|
|
535
|
+
self.children.add_child(return_type)
|
|
534
536
|
|
|
535
|
-
def
|
|
537
|
+
def _move(parent_reference):
|
|
538
|
+
# type: (ItemReference) -> None
|
|
536
539
|
payload = {"name": name, "parentReference": parent_reference}
|
|
537
540
|
|
|
538
541
|
def _construct_request(request):
|
|
539
542
|
# type: (RequestOptions) -> None
|
|
540
543
|
request.method = HttpMethod.Patch
|
|
544
|
+
request.url += "?@microsoft.graph.conflictBehavior={0}".format(
|
|
545
|
+
conflict_behavior
|
|
546
|
+
)
|
|
541
547
|
|
|
542
|
-
self
|
|
543
|
-
qry
|
|
544
|
-
self.context.add_query(qry)
|
|
548
|
+
qry = ServiceOperationQuery(self, "", None, payload, None, return_type)
|
|
549
|
+
self.context.add_query(qry).before_execute(_construct_request)
|
|
545
550
|
|
|
546
551
|
if isinstance(parent, DriveItem):
|
|
547
552
|
|
|
548
553
|
def _drive_item_loaded():
|
|
549
|
-
|
|
554
|
+
_move(ItemReference(_id=parent.id))
|
|
550
555
|
|
|
551
556
|
parent.ensure_property("parentReference", _drive_item_loaded)
|
|
552
557
|
else:
|
|
553
|
-
|
|
558
|
+
_move(parent)
|
|
554
559
|
return return_type
|
|
555
560
|
|
|
556
561
|
def rename(self, new_name):
|
|
@@ -618,9 +623,9 @@ class DriveItem(BaseItem):
|
|
|
618
623
|
DriveRecipient, [DriveRecipient.from_email(r) for r in recipients]
|
|
619
624
|
),
|
|
620
625
|
"message": message,
|
|
621
|
-
"expirationDateTime":
|
|
622
|
-
|
|
623
|
-
|
|
626
|
+
"expirationDateTime": (
|
|
627
|
+
expiration_datetime.isoformat() + "Z" if expiration_datetime else None
|
|
628
|
+
),
|
|
624
629
|
"password": password,
|
|
625
630
|
"retainInheritedPermissions": retain_inherited_permissions,
|
|
626
631
|
}
|
|
@@ -662,7 +667,7 @@ class DriveItem(BaseItem):
|
|
|
662
667
|
return self
|
|
663
668
|
|
|
664
669
|
def restore(self, parent_reference=None, name=None):
|
|
665
|
-
# type: (ItemReference
|
|
670
|
+
# type: (Optional[ItemReference], str) -> "DriveItem"
|
|
666
671
|
"""
|
|
667
672
|
Restore a driveItem that has been deleted and is currently in the recycle bin.
|
|
668
673
|
NOTE: This functionality is currently only available for OneDrive Personal.
|
|
@@ -910,8 +915,6 @@ class DriveItem(BaseItem):
|
|
|
910
915
|
|
|
911
916
|
def set_property(self, name, value, persist_changes=True):
|
|
912
917
|
super(DriveItem, self).set_property(name, value, persist_changes)
|
|
913
|
-
if name == "parentReference":
|
|
914
|
-
self._resource_path.parent.patch(self.parent_reference.driveId)
|
|
915
918
|
return self
|
|
916
919
|
|
|
917
920
|
def get_property(self, name, default_value=None):
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Self
|
|
4
|
+
|
|
1
5
|
from office365.onedrive.internal.paths.root import RootPath
|
|
2
6
|
from office365.runtime.paths.v4.entity import EntityPath
|
|
3
7
|
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
10
|
+
|
|
4
11
|
|
|
5
12
|
class UrlPath(EntityPath):
|
|
6
13
|
"""Resource path for OneDrive entity path-based addressing"""
|
|
7
14
|
|
|
8
15
|
def __init__(self, url, parent, collection=None):
|
|
16
|
+
# type: (str, ResourcePath, ResourcePath) -> None
|
|
9
17
|
"""
|
|
10
18
|
:param str url: File or Folder server relative url
|
|
11
19
|
:type parent: office365.runtime.paths.resource_path.ResourcePath
|
|
@@ -16,8 +24,14 @@ class UrlPath(EntityPath):
|
|
|
16
24
|
parent = parent.parent
|
|
17
25
|
elif isinstance(parent, RootPath):
|
|
18
26
|
collection = parent.collection
|
|
27
|
+
elif isinstance(parent, EntityPath):
|
|
28
|
+
collection = parent.collection
|
|
19
29
|
super(UrlPath, self).__init__(url, parent, collection)
|
|
20
30
|
|
|
31
|
+
def patch(self, key):
|
|
32
|
+
# type: (str) -> Self
|
|
33
|
+
return super(UrlPath, self).patch(key)
|
|
34
|
+
|
|
21
35
|
@property
|
|
22
36
|
def segment(self):
|
|
23
37
|
return ":/{0}:/".format(self._key)
|
|
@@ -26,3 +26,9 @@ class ListCollection(EntityCollection[List]):
|
|
|
26
26
|
qry = CreateEntityQuery(self, payload, return_type)
|
|
27
27
|
self.context.add_query(qry)
|
|
28
28
|
return return_type
|
|
29
|
+
|
|
30
|
+
def get_by_name(self, name):
|
|
31
|
+
return List(self.context, EntityPath(name, self.resource_path))
|
|
32
|
+
|
|
33
|
+
def get_by_id(self, list_id):
|
|
34
|
+
return List(self.context, EntityPath(list_id, self.resource_path))
|
|
@@ -5,13 +5,30 @@ class SharePointIds(ClientValue):
|
|
|
5
5
|
"""The SharePointIds resource groups the various identifiers for an item stored in a SharePoint site or OneDrive
|
|
6
6
|
for Business into a single structure."""
|
|
7
7
|
|
|
8
|
-
def __init__(
|
|
8
|
+
def __init__(
|
|
9
|
+
self,
|
|
10
|
+
list_id=None,
|
|
11
|
+
list_item_id=None,
|
|
12
|
+
list_item_unique_id=None,
|
|
13
|
+
siteId=None,
|
|
14
|
+
siteUrl=None,
|
|
15
|
+
tenantId=None,
|
|
16
|
+
webId=None,
|
|
17
|
+
):
|
|
9
18
|
"""
|
|
10
19
|
:param str list_id: The unique identifier (guid) for the item's list in SharePoint.
|
|
11
20
|
:param str list_item_id: An integer identifier for the item within the containing list.
|
|
12
21
|
:param str list_item_unique_id: The unique identifier (guid) for the item within OneDrive for Business
|
|
13
22
|
or a SharePoint site.
|
|
23
|
+
:param str siteId: The unique identifier (guid) for the item's site collection (SPSite).
|
|
24
|
+
:param str siteUrl: The SharePoint URL for the site that contains the item.
|
|
25
|
+
:param str tenantId: The unique identifier (guid) for the tenancy.
|
|
26
|
+
:param str webId: The unique identifier (guid) for the item's site (SPWeb).
|
|
14
27
|
"""
|
|
15
28
|
self.listId = list_id
|
|
16
29
|
self.listItemId = list_item_id
|
|
17
30
|
self.listItemUniqueId = list_item_unique_id
|
|
31
|
+
self.siteId = siteId
|
|
32
|
+
self.siteUrl = siteUrl
|
|
33
|
+
self.tenantId = tenantId
|
|
34
|
+
self.webId = webId
|
|
@@ -8,7 +8,6 @@ from office365.onedrive.lists.list import List
|
|
|
8
8
|
from office365.onedrive.permissions.permission import Permission
|
|
9
9
|
from office365.onedrive.sites.site import Site
|
|
10
10
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
11
|
-
from office365.runtime.paths.v4.entity import EntityPath
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
class SharedDriveItem(BaseItem):
|
|
@@ -48,7 +47,7 @@ class SharedDriveItem(BaseItem):
|
|
|
48
47
|
"""Used to access the underlying driveItem"""
|
|
49
48
|
return self.properties.get(
|
|
50
49
|
"driveItem",
|
|
51
|
-
DriveItem(self.context,
|
|
50
|
+
DriveItem(self.context, ResourcePath("driveItem", self.resource_path)),
|
|
52
51
|
)
|
|
53
52
|
|
|
54
53
|
@property
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from office365.entity import Entity
|
|
2
2
|
from office365.entity_collection import EntityCollection
|
|
3
|
-
from office365.onedrive.sitepages.web_part import WebPart
|
|
3
|
+
from office365.onedrive.sitepages.webparts.web_part import WebPart
|
|
4
4
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4,7 +4,7 @@ from office365.entity_collection import EntityCollection
|
|
|
4
4
|
from office365.onedrive.sitepages.base import BaseSitePage
|
|
5
5
|
from office365.onedrive.sitepages.canvas_layout import CanvasLayout
|
|
6
6
|
from office365.onedrive.sitepages.title_area import TitleArea
|
|
7
|
-
from office365.onedrive.sitepages.web_part import WebPart
|
|
7
|
+
from office365.onedrive.sitepages.webparts.web_part import WebPart
|
|
8
8
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
9
9
|
from office365.runtime.queries.function import FunctionQuery
|
|
10
10
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from office365.entity import Entity
|
|
2
2
|
from office365.entity_collection import EntityCollection
|
|
3
|
-
from office365.onedrive.sitepages.web_part import WebPart
|
|
3
|
+
from office365.onedrive.sitepages.webparts.web_part import WebPart
|
|
4
4
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
5
5
|
|
|
6
6
|
|
|
File without changes
|
|
File without changes
|
|
@@ -2,11 +2,18 @@ from typing import Optional
|
|
|
2
2
|
|
|
3
3
|
from office365.entity import Entity
|
|
4
4
|
from office365.onedrive.workbooks.filter_criteria import WorkbookFilterCriteria
|
|
5
|
+
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class WorkbookFilter(Entity):
|
|
8
9
|
"""Manages the filtering of a table's column."""
|
|
9
10
|
|
|
11
|
+
def clear(self):
|
|
12
|
+
"""Clear the filter on the given column."""
|
|
13
|
+
qry = ServiceOperationQuery(self, "clear")
|
|
14
|
+
self.context.add_query(qry)
|
|
15
|
+
return self
|
|
16
|
+
|
|
10
17
|
@property
|
|
11
18
|
def criteria(self):
|
|
12
19
|
# type: () -> Optional[WorkbookFilterCriteria]
|