Office365-REST-Python-Client 2.5.10__py3-none-any.whl → 2.5.12__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.10.dist-info → Office365_REST_Python_Client-2.5.12.dist-info}/METADATA +14 -10
- {Office365_REST_Python_Client-2.5.10.dist-info → Office365_REST_Python_Client-2.5.12.dist-info}/RECORD +85 -69
- {Office365_REST_Python_Client-2.5.10.dist-info → Office365_REST_Python_Client-2.5.12.dist-info}/WHEEL +1 -1
- office365/directory/authentication/conditions/__init__.py +0 -0
- office365/directory/authentication/conditions/application.py +5 -0
- office365/directory/authentication/conditions/applications.py +5 -0
- office365/directory/authentication/conditions/conditions.py +11 -0
- 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 +11 -25
- office365/graph_request.py +24 -1
- office365/onedrive/driveitems/driveItem.py +41 -38
- office365/onedrive/idle_session_signout.py +15 -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/sharepoint_settings.py +13 -0
- office365/onedrive/shares/drive_item.py +1 -2
- office365/onedrive/sitepages/title_area.py +15 -5
- 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/calendar/sharing/__init__.py +0 -0
- office365/outlook/calendar/sharing/message_action.py +5 -0
- office365/outlook/calendar/sharing_message.py +19 -0
- office365/outlook/calendar/timezones/custom.py +9 -0
- office365/outlook/category.py +7 -0
- office365/outlook/mail/automatic_replies_setting.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/outlook/mail/messages/rules/predicates.py +5 -0
- office365/outlook/mail/messages/rules/rule.py +4 -3
- office365/runtime/auth/providers/saml_token_provider.py +4 -4
- office365/runtime/http/request_options.py +7 -3
- office365/runtime/odata/query_options.py +3 -0
- office365/runtime/queries/batch.py +4 -0
- office365/runtime/queries/create_entity.py +6 -8
- office365/runtime/queries/update_entity.py +3 -5
- office365/sharepoint/appprincipal/identity_provider.py +7 -1
- office365/sharepoint/attachments/attachment.py +14 -2
- office365/sharepoint/attachments/collection.py +27 -4
- office365/sharepoint/changes/app_consent_principal.py +5 -0
- office365/sharepoint/changes/file.py +4 -0
- office365/sharepoint/client_context.py +4 -3
- office365/sharepoint/directory/group.py +9 -9
- office365/sharepoint/directory/helper.py +6 -4
- office365/sharepoint/documentmanagement/document_set.py +7 -8
- office365/sharepoint/entity.py +4 -3
- 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/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/pages/collection.py +1 -1
- office365/sharepoint/publishing/sites/communication/site.py +4 -3
- office365/sharepoint/request.py +33 -1
- 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/recent_admin_action_report.py +2 -2
- office365/sharepoint/tenant/administration/tenant.py +50 -4
- {Office365_REST_Python_Client-2.5.10.dist-info → Office365_REST_Python_Client-2.5.12.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.10.dist-info → Office365_REST_Python_Client-2.5.12.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.runtime.client_result import ClientResult
|
|
2
4
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
3
5
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
@@ -16,6 +18,7 @@ class SPHelper(Entity):
|
|
|
16
18
|
|
|
17
19
|
@staticmethod
|
|
18
20
|
def is_member_of(context, principal_name, group_id, result=None):
|
|
21
|
+
# type: (ClientContext, str, str, Optional[ClientResult[bool]]) -> ClientResult[bool]
|
|
19
22
|
"""
|
|
20
23
|
:param str principal_name: User principal name
|
|
21
24
|
:param str group_id: Group id
|
|
@@ -34,10 +37,7 @@ class SPHelper(Entity):
|
|
|
34
37
|
@staticmethod
|
|
35
38
|
def check_site_availability(context, site_url):
|
|
36
39
|
# type: (ClientContext, str) -> ClientResult[bool]
|
|
37
|
-
"""
|
|
38
|
-
:param str site_url: Site Url
|
|
39
|
-
:param office365.sharepoint.client_context.ClientContext context: SharePoint context
|
|
40
|
-
"""
|
|
40
|
+
""" """
|
|
41
41
|
return_type = ClientResult(context)
|
|
42
42
|
qry = ServiceOperationQuery(
|
|
43
43
|
SPHelper(context),
|
|
@@ -121,6 +121,7 @@ class SPHelper(Entity):
|
|
|
121
121
|
|
|
122
122
|
@staticmethod
|
|
123
123
|
def get_owners(context, group_id, return_type=None):
|
|
124
|
+
# type: (ClientContext, str, Optional[EntityCollection[User]]) -> SPHelper
|
|
124
125
|
"""
|
|
125
126
|
:param str group_id: Group identifier
|
|
126
127
|
:param office365.sharepoint.client_context.ClientContext context: SharePoint context
|
|
@@ -137,6 +138,7 @@ class SPHelper(Entity):
|
|
|
137
138
|
|
|
138
139
|
@staticmethod
|
|
139
140
|
def remove_external_members(context, group_id):
|
|
141
|
+
# type: (ClientContext, str) -> SPHelper
|
|
140
142
|
"""
|
|
141
143
|
:param str group_id: Group identifier
|
|
142
144
|
:param office365.sharepoint.client_context.ClientContext context: SharePoint context
|
|
@@ -21,16 +21,9 @@ class DocumentSet(Folder):
|
|
|
21
21
|
|
|
22
22
|
return_type = DocumentSet(context)
|
|
23
23
|
|
|
24
|
-
def _parent_folder_loaded():
|
|
25
|
-
custom_props = parent_folder.get_property("Properties")
|
|
26
|
-
list_id = custom_props.get("vti_x005f_listname")
|
|
27
|
-
target_list = context.web.lists.get_by_id(list_id)
|
|
28
|
-
target_list.ensure_property("Title", _create, target_list=target_list)
|
|
29
|
-
|
|
30
24
|
def _create(target_list):
|
|
31
25
|
# type: (List) -> None
|
|
32
26
|
qry = ClientQuery(context, return_type=return_type)
|
|
33
|
-
context.add_query(qry)
|
|
34
27
|
folder_url = parent_folder.serverRelativeUrl + "/" + name
|
|
35
28
|
return_type.set_property("ServerRelativeUrl", folder_url)
|
|
36
29
|
|
|
@@ -43,7 +36,13 @@ class DocumentSet(Folder):
|
|
|
43
36
|
request.set_header("Slug", "{0}|{1}".format(folder_url, ct_id))
|
|
44
37
|
request.method = HttpMethod.Post
|
|
45
38
|
|
|
46
|
-
context.
|
|
39
|
+
context.add_query(qry).before_query_execute(_construct_request)
|
|
40
|
+
|
|
41
|
+
def _parent_folder_loaded():
|
|
42
|
+
custom_props = parent_folder.get_property("Properties")
|
|
43
|
+
list_id = custom_props.get("vti_x005f_listname")
|
|
44
|
+
target_list = context.web.lists.get_by_id(list_id)
|
|
45
|
+
target_list.ensure_property("Title", _create, target_list=target_list)
|
|
47
46
|
|
|
48
47
|
parent_folder.ensure_properties(
|
|
49
48
|
["UniqueId", "Properties", "ServerRelativeUrl"], _parent_folder_loaded
|
office365/sharepoint/entity.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
from typing import TYPE_CHECKING, Callable
|
|
1
|
+
from typing import TYPE_CHECKING, Callable, List
|
|
2
2
|
|
|
3
3
|
from typing_extensions import Self
|
|
4
4
|
|
|
5
5
|
from office365.runtime.auth.client_credential import ClientCredential
|
|
6
6
|
from office365.runtime.auth.user_credential import UserCredential
|
|
7
7
|
from office365.runtime.client_object import ClientObject
|
|
8
|
+
from office365.runtime.client_result import ClientResult
|
|
8
9
|
from office365.runtime.paths.v3.entity import EntityPath
|
|
9
10
|
from office365.runtime.queries.delete_entity import DeleteEntityQuery
|
|
10
11
|
from office365.runtime.queries.update_entity import UpdateEntityQuery
|
|
@@ -22,13 +23,13 @@ class Entity(ClientObject):
|
|
|
22
23
|
return self
|
|
23
24
|
|
|
24
25
|
def execute_batch(self, items_per_batch=100, success_callback=None):
|
|
25
|
-
# type: (int, Callable[[
|
|
26
|
+
# type: (int, Callable[[List[ClientObject|ClientResult]], None]) -> Self
|
|
26
27
|
"""Construct and submit to a server a batch request"""
|
|
27
28
|
return self.context.execute_batch(items_per_batch, success_callback)
|
|
28
29
|
|
|
29
30
|
def with_credentials(self, credentials):
|
|
30
31
|
# type: (UserCredential|ClientCredential) -> Self
|
|
31
|
-
""" """
|
|
32
|
+
"""Initializes a client to acquire a token via user or client credentials"""
|
|
32
33
|
self.context.with_credentials(credentials)
|
|
33
34
|
return self
|
|
34
35
|
|
|
@@ -9,3 +9,22 @@ class SPBuiltInFieldId:
|
|
|
9
9
|
|
|
10
10
|
FSObjType = "FSObjType"
|
|
11
11
|
"""Identifies a field that contains information about the file system type"""
|
|
12
|
+
|
|
13
|
+
FileType = "FileType"
|
|
14
|
+
"""Identifies a field that contains information about the file type for version history of the specified
|
|
15
|
+
SharePoint Foundation library picture object."""
|
|
16
|
+
|
|
17
|
+
FirstName = "FirstName"
|
|
18
|
+
"""Identifies a field that contains the first name for the specified SharePoint Foundation contact object."""
|
|
19
|
+
|
|
20
|
+
FormData = "FormData"
|
|
21
|
+
"""Identifies a field that contains the FormData property for the specified
|
|
22
|
+
Microsoft SharePoint Foundation contact object."""
|
|
23
|
+
|
|
24
|
+
FormURN = "FormURN"
|
|
25
|
+
"""Identifies a field that contains the FormURN property for the specified
|
|
26
|
+
Microsoft SharePoint Foundation contact object."""
|
|
27
|
+
|
|
28
|
+
fRecurrence = "fRecurrence"
|
|
29
|
+
"""Identifies a field that contains information about the recurrence field of the specified SharePoint Foundation
|
|
30
|
+
calendar event object."""
|
|
@@ -222,9 +222,7 @@ class FieldCollection(EntityCollection[Field]):
|
|
|
222
222
|
|
|
223
223
|
:type field_create_information: office365.sharepoint.fields.creation_information.FieldCreationInformation
|
|
224
224
|
"""
|
|
225
|
-
return_type = Field.
|
|
226
|
-
self.context, field_create_information
|
|
227
|
-
)
|
|
225
|
+
return_type = Field.create_field(self.context, field_create_information)
|
|
228
226
|
self.add_child(return_type)
|
|
229
227
|
qry = CreateEntityQuery(self, return_type, return_type)
|
|
230
228
|
self.context.add_query(qry)
|
|
@@ -14,8 +14,11 @@ class Field(Entity):
|
|
|
14
14
|
def __init__(self, context, resource_path=None):
|
|
15
15
|
super(Field, self).__init__(context, resource_path)
|
|
16
16
|
|
|
17
|
+
def __str__(self):
|
|
18
|
+
return self.title or self.entity_type_name
|
|
19
|
+
|
|
17
20
|
def __repr__(self):
|
|
18
|
-
return self.internal_name or self.id
|
|
21
|
+
return self.internal_name or self.id or self.entity_type_name
|
|
19
22
|
|
|
20
23
|
@staticmethod
|
|
21
24
|
def resolve_field_type(type_id_or_name):
|
|
@@ -63,7 +66,7 @@ class Field(Entity):
|
|
|
63
66
|
return Field
|
|
64
67
|
|
|
65
68
|
@staticmethod
|
|
66
|
-
def
|
|
69
|
+
def create_field(context, field_parameters):
|
|
67
70
|
"""
|
|
68
71
|
Creates a field based on its type
|
|
69
72
|
|
|
@@ -684,7 +684,7 @@ class File(AbstractFile):
|
|
|
684
684
|
chunk_downloaded(bytes_read)
|
|
685
685
|
file_object.write(chunk)
|
|
686
686
|
|
|
687
|
-
self.context.add_query(qry).
|
|
687
|
+
self.context.add_query(qry).before_query_execute(
|
|
688
688
|
_construct_request
|
|
689
689
|
).after_execute(_process_response)
|
|
690
690
|
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
from typing import IO, TYPE_CHECKING
|
|
2
|
+
|
|
1
3
|
from office365.runtime.http.http_method import HttpMethod
|
|
4
|
+
from office365.runtime.http.request_options import RequestOptions
|
|
2
5
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
3
6
|
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from office365.sharepoint.attachments.attachment import Attachment
|
|
9
|
+
from office365.sharepoint.files.file import File
|
|
4
10
|
|
|
5
|
-
def create_upload_file_query(file, file_object):
|
|
6
|
-
"""
|
|
7
|
-
Constructs upload file content query
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"""
|
|
12
|
+
def create_upload_file_query(file, file_object):
|
|
13
|
+
# type: (File|Attachment, IO) -> ServiceOperationQuery
|
|
14
|
+
"""Constructs upload file content query"""
|
|
12
15
|
qry = ServiceOperationQuery(file, "$value")
|
|
13
16
|
|
|
14
|
-
def
|
|
17
|
+
def _construct_request(request):
|
|
18
|
+
# type: (RequestOptions) -> None
|
|
15
19
|
request.data = file_object.read()
|
|
16
20
|
request.method = HttpMethod.Post
|
|
17
21
|
request.set_header("X-HTTP-Method", "PUT")
|
|
18
22
|
|
|
19
|
-
file.context.before_execute(
|
|
23
|
+
file.context.before_execute(_construct_request)
|
|
20
24
|
return qry
|
|
@@ -15,13 +15,14 @@ class NavigationNode(Entity):
|
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
def __str__(self):
|
|
18
|
-
return self.title
|
|
18
|
+
return self.title or self.entity_type_name
|
|
19
19
|
|
|
20
20
|
def __repr__(self):
|
|
21
|
-
return self.url
|
|
21
|
+
return self.url or self.entity_type_name
|
|
22
22
|
|
|
23
23
|
@property
|
|
24
24
|
def children(self):
|
|
25
|
+
# type: () -> NavigationNodeCollection
|
|
25
26
|
"""Gets the collection of child nodes of the navigation node."""
|
|
26
27
|
return self.properties.get(
|
|
27
28
|
"Children",
|
|
@@ -49,6 +50,7 @@ class NavigationNode(Entity):
|
|
|
49
50
|
|
|
50
51
|
@url.setter
|
|
51
52
|
def url(self, value):
|
|
53
|
+
# type: (str) -> None
|
|
52
54
|
"""Sets a value that specifies the URL stored with the navigation node."""
|
|
53
55
|
self.set_property("Url", value)
|
|
54
56
|
|
|
@@ -1,7 +1,41 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.sharepoint.entity import Entity
|
|
2
4
|
|
|
3
5
|
|
|
4
6
|
class AppDetails(Entity):
|
|
7
|
+
"""Specifies the detail properties for a SharePoint Add-in."""
|
|
8
|
+
|
|
9
|
+
@property
|
|
10
|
+
def eula_url(self):
|
|
11
|
+
# type: () -> Optional[str]
|
|
12
|
+
"""Specifies the URL to get the End User License Agreement (EULA) information for the SharePoint Add-in."""
|
|
13
|
+
return self.properties.get("EulaUrl", None)
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def privacy_url(self):
|
|
17
|
+
# type: () -> Optional[str]
|
|
18
|
+
"""Specifies the URL of the privacy statement for the SharePoint Add-in."""
|
|
19
|
+
return self.properties.get("PrivacyUrl", None)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def publisher(self):
|
|
23
|
+
# type: () -> Optional[str]
|
|
24
|
+
"""Specifies the publisher name for the SharePoint Add-in."""
|
|
25
|
+
return self.properties.get("Publisher", None)
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def short_description(self):
|
|
29
|
+
# type: () -> Optional[str]
|
|
30
|
+
"""Specifies a short description for the SharePoint Add-in."""
|
|
31
|
+
return self.properties.get("ShortDescription", None)
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def support_url(self):
|
|
35
|
+
# type: () -> Optional[str]
|
|
36
|
+
"""Specifies the URL of the support page for the SharePoint Add-in."""
|
|
37
|
+
return self.properties.get("SupportUrl", None)
|
|
38
|
+
|
|
5
39
|
@property
|
|
6
40
|
def entity_type_name(self):
|
|
7
41
|
return "Microsoft.SharePoint.Packaging.AppDetails"
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
1
4
|
from office365.runtime.types.collections import StringCollection
|
|
2
5
|
from office365.sharepoint.entity import Entity
|
|
3
6
|
|
|
@@ -7,23 +10,27 @@ class DlpPolicyTip(Entity):
|
|
|
7
10
|
|
|
8
11
|
@property
|
|
9
12
|
def applied_actions_text(self):
|
|
13
|
+
# type: () -> Optional[str]
|
|
10
14
|
"""Specifies the text which states what restrictive actions have been applied to this item."""
|
|
11
15
|
return self.properties.get("AppliedActionsText", None)
|
|
12
16
|
|
|
13
17
|
@property
|
|
14
18
|
def compliance_url(self):
|
|
19
|
+
# type: () -> Optional[str]
|
|
15
20
|
"""Specifies the URL that provides additional help on the policy tip dialog."""
|
|
16
21
|
return self.properties.get("ComplianceUrl", None)
|
|
17
22
|
|
|
18
23
|
@property
|
|
19
24
|
def general_text(self):
|
|
25
|
+
# type: () -> Optional[str]
|
|
20
26
|
"""General text that appears on the top of the policy tip dialog."""
|
|
21
27
|
return self.properties.get("GeneralText", None)
|
|
22
28
|
|
|
23
29
|
@property
|
|
24
30
|
def last_processed_time(self):
|
|
31
|
+
# type: () -> Optional[datetime]
|
|
25
32
|
"""The last time this item was processed for policy matches."""
|
|
26
|
-
return self.properties.get("LastProcessedTime",
|
|
33
|
+
return self.properties.get("LastProcessedTime", datetime.min)
|
|
27
34
|
|
|
28
35
|
@property
|
|
29
36
|
def matched_condition_descriptions(self):
|
|
@@ -37,5 +44,6 @@ class DlpPolicyTip(Entity):
|
|
|
37
44
|
|
|
38
45
|
@property
|
|
39
46
|
def two_letter_iso_language_name(self):
|
|
47
|
+
# type: () -> Optional[str]
|
|
40
48
|
"""The two-letter language code of the generated policy tip detail."""
|
|
41
49
|
return self.properties.get("TwoLetterISOLanguageName", None)
|
|
@@ -80,7 +80,7 @@ class SPSiteManager(Entity):
|
|
|
80
80
|
request.method = HttpMethod.Get
|
|
81
81
|
request.url += "?url='{0}'".format(site_url)
|
|
82
82
|
|
|
83
|
-
self.context.add_query(qry).
|
|
83
|
+
self.context.add_query(qry).before_query_execute(_construct_request)
|
|
84
84
|
return response
|
|
85
85
|
|
|
86
86
|
def get_site_url(self, site_id):
|
|
@@ -11,7 +11,12 @@ class Principal(Entity):
|
|
|
11
11
|
return self.title or self.entity_type_name
|
|
12
12
|
|
|
13
13
|
def __repr__(self):
|
|
14
|
-
return
|
|
14
|
+
return (
|
|
15
|
+
self.user_principal_name
|
|
16
|
+
or self.login_name
|
|
17
|
+
or self.id
|
|
18
|
+
or self.entity_type_name
|
|
19
|
+
)
|
|
15
20
|
|
|
16
21
|
@property
|
|
17
22
|
def id(self):
|
|
@@ -55,6 +60,10 @@ class Principal(Entity):
|
|
|
55
60
|
"""Gets the type of the principal."""
|
|
56
61
|
return self.properties.get("PrincipalType", None)
|
|
57
62
|
|
|
63
|
+
@property
|
|
64
|
+
def property_ref_name(self):
|
|
65
|
+
return "Id"
|
|
66
|
+
|
|
58
67
|
def set_property(self, name, value, persist_changes=True):
|
|
59
68
|
super(Principal, self).set_property(name, value, persist_changes)
|
|
60
69
|
# fallback: create a new resource path
|
|
@@ -19,9 +19,7 @@ class UserCollection(EntityCollection[User]):
|
|
|
19
19
|
self.add_child(return_type)
|
|
20
20
|
|
|
21
21
|
def _create_and_add_query(login_name):
|
|
22
|
-
|
|
23
|
-
:type login_name: str
|
|
24
|
-
"""
|
|
22
|
+
# type: (str) -> None
|
|
25
23
|
return_type.set_property("LoginName", login_name)
|
|
26
24
|
qry = CreateEntityQuery(self, return_type, return_type)
|
|
27
25
|
self.context.add_query(qry)
|
|
@@ -62,7 +62,7 @@ class SitePageCollection(SitePageMetadataCollection[SitePage]):
|
|
|
62
62
|
return return_type
|
|
63
63
|
|
|
64
64
|
def get_page_column_state(self, url):
|
|
65
|
-
"""
|
|
65
|
+
"""
|
|
66
66
|
Determines whether a specific SitePage is a single or multicolumn page.
|
|
67
67
|
|
|
68
68
|
:param str url: URL of the SitePage for which to return state.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from office365.runtime.client_result import ClientResult
|
|
2
2
|
from office365.runtime.http.http_method import HttpMethod
|
|
3
|
+
from office365.runtime.http.request_options import RequestOptions
|
|
3
4
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
4
5
|
from office365.sharepoint.entity import Entity
|
|
5
6
|
from office365.sharepoint.publishing.sites.communication.creation_request import (
|
|
@@ -61,13 +62,13 @@ class CommunicationSite(Entity):
|
|
|
61
62
|
qry = ServiceOperationQuery(
|
|
62
63
|
self, "Status", None, {"url": site_url}, None, response
|
|
63
64
|
)
|
|
64
|
-
self.context.add_query(qry)
|
|
65
65
|
|
|
66
|
-
def
|
|
66
|
+
def _construct_request(request):
|
|
67
|
+
# type: (RequestOptions) -> None
|
|
67
68
|
request.method = HttpMethod.Get
|
|
68
69
|
request.url += "?url='{0}'".format(site_url)
|
|
69
70
|
|
|
70
|
-
self.context.
|
|
71
|
+
self.context.add_query(qry).before_query_execute(_construct_request)
|
|
71
72
|
return response
|
|
72
73
|
|
|
73
74
|
def enable(self, design_package_id):
|
office365/sharepoint/request.py
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from requests import Response
|
|
4
|
+
from typing_extensions import Self
|
|
5
|
+
|
|
6
|
+
from office365.runtime.auth.authentication_context import AuthenticationContext
|
|
7
|
+
from office365.runtime.auth.client_credential import ClientCredential
|
|
8
|
+
from office365.runtime.auth.user_credential import UserCredential
|
|
9
|
+
from office365.runtime.http.request_options import RequestOptions
|
|
1
10
|
from office365.runtime.odata.request import ODataRequest
|
|
2
11
|
from office365.runtime.odata.v3.json_light_format import JsonLightFormat
|
|
3
12
|
|
|
4
13
|
|
|
5
14
|
class SharePointRequest(ODataRequest):
|
|
6
|
-
def __init__(self):
|
|
15
|
+
def __init__(self, base_url):
|
|
7
16
|
super().__init__(JsonLightFormat())
|
|
17
|
+
self._auth_context = AuthenticationContext(url=base_url)
|
|
18
|
+
self.beforeExecute += self._authenticate_request
|
|
19
|
+
|
|
20
|
+
def execute_request(self, path):
|
|
21
|
+
# type: (str) -> Response
|
|
22
|
+
request_url = "{0}/_api/{1}".format(self._auth_context.url, path)
|
|
23
|
+
return self.execute_request_direct(RequestOptions(request_url))
|
|
24
|
+
|
|
25
|
+
def with_credentials(self, credentials, environment="commercial"):
|
|
26
|
+
# type: (UserCredential|ClientCredential, Optional[str]) -> Self
|
|
27
|
+
"""
|
|
28
|
+
Initializes a client to acquire a token via user or client credentials
|
|
29
|
+
:type credentials: UserCredential or ClientCredential
|
|
30
|
+
:param str environment: The Office 365 Cloud Environment endpoint used for authentication
|
|
31
|
+
defaults to 'commercial'.
|
|
32
|
+
"""
|
|
33
|
+
self._auth_context.with_credentials(credentials, environment=environment)
|
|
34
|
+
return self
|
|
35
|
+
|
|
36
|
+
def _authenticate_request(self, request):
|
|
37
|
+
# type: (RequestOptions) -> None
|
|
38
|
+
"""Authenticate request"""
|
|
39
|
+
self._auth_context.authenticate_request(request)
|
|
@@ -22,6 +22,11 @@ class SharingInformation(Entity):
|
|
|
22
22
|
"""
|
|
23
23
|
return self.properties.get("accessRequestSettings", AccessRequestSettings())
|
|
24
24
|
|
|
25
|
+
@property
|
|
26
|
+
def anonymous_link_expiration_restriction_days(self):
|
|
27
|
+
"""Tenant's anonymous link expiration restriction in days."""
|
|
28
|
+
return self.properties.get("anonymousLinkExpirationRestrictionDays", None)
|
|
29
|
+
|
|
25
30
|
@property
|
|
26
31
|
def permissions_information(self):
|
|
27
32
|
"""
|
|
@@ -14,25 +14,29 @@ class PermissionCollection(ClientValue):
|
|
|
14
14
|
|
|
15
15
|
def __init__(
|
|
16
16
|
self,
|
|
17
|
-
|
|
17
|
+
app_consent_principals=None,
|
|
18
|
+
has_inherited_links=None,
|
|
18
19
|
links=None,
|
|
19
20
|
principals=None,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
site_admins=None,
|
|
22
|
+
total_number_of_principals=None,
|
|
22
23
|
):
|
|
23
24
|
"""
|
|
24
|
-
:param bool
|
|
25
|
+
:param bool has_inherited_links:
|
|
25
26
|
:param list[LinkInfo] links: The List of tokenized sharing links with their LinkInfo objects.
|
|
26
27
|
:param list[PrincipalInfo] principals: The List of Principals with their roles on this list item.
|
|
27
|
-
:param list[PrincipalInfo]
|
|
28
|
+
:param list[PrincipalInfo] site_admins: The List of Principals who are Site Admins. This property is returned
|
|
28
29
|
only if the caller is an Auditor.
|
|
29
|
-
:param int
|
|
30
|
+
:param int total_number_of_principals:
|
|
30
31
|
"""
|
|
31
|
-
self.
|
|
32
|
+
self.appConsentPrincipals = ClientValueCollection(
|
|
33
|
+
PrincipalInfo, app_consent_principals
|
|
34
|
+
)
|
|
35
|
+
self.hasInheritedLinks = has_inherited_links
|
|
32
36
|
self.links = ClientValueCollection(LinkInfo, links)
|
|
33
37
|
self.principals = ClientValueCollection(PrincipalInfo, principals)
|
|
34
|
-
self.siteAdmins = ClientValueCollection(PrincipalInfo,
|
|
35
|
-
self.totalNumberOfPrincipals =
|
|
38
|
+
self.siteAdmins = ClientValueCollection(PrincipalInfo, site_admins)
|
|
39
|
+
self.totalNumberOfPrincipals = total_number_of_principals
|
|
36
40
|
|
|
37
41
|
@property
|
|
38
42
|
def entity_type_name(self):
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from office365.runtime.client_result import ClientResult
|
|
2
2
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
3
|
+
from office365.sharepoint.client_context import ClientContext
|
|
3
4
|
from office365.sharepoint.entity import Entity
|
|
4
5
|
from office365.sharepoint.sharing.reports.site_capabilities import (
|
|
5
6
|
SiteSharingReportCapabilities,
|
|
@@ -12,9 +13,7 @@ from office365.sharepoint.sharing.site_sharing_report_status import (
|
|
|
12
13
|
class SiteSharingReportHelper(Entity):
|
|
13
14
|
@staticmethod
|
|
14
15
|
def cancel_sharing_report_job(context):
|
|
15
|
-
|
|
16
|
-
:type context: office365.sharepoint.client_context.ClientContext
|
|
17
|
-
"""
|
|
16
|
+
# type: (ClientContext) -> ClientResult[SiteSharingReportStatus]
|
|
18
17
|
return_type = ClientResult(context, SiteSharingReportStatus())
|
|
19
18
|
binding_type = SiteSharingReportHelper(context)
|
|
20
19
|
qry = ServiceOperationQuery(
|
|
@@ -4,10 +4,10 @@ from office365.runtime.client_value import ClientValue
|
|
|
4
4
|
class RecentAdminActionReport(ClientValue):
|
|
5
5
|
""" """
|
|
6
6
|
|
|
7
|
-
def __init__(self, actions=None,
|
|
7
|
+
def __init__(self, actions=None, created_by_email=None):
|
|
8
8
|
# type: (str, str) -> None
|
|
9
9
|
self.actions = actions
|
|
10
|
-
self.createdByEmail =
|
|
10
|
+
self.createdByEmail = created_by_email
|
|
11
11
|
|
|
12
12
|
@property
|
|
13
13
|
def entity_type_name(self):
|
|
@@ -319,11 +319,57 @@ class Tenant(Entity):
|
|
|
319
319
|
self.context.add_query(qry)
|
|
320
320
|
return return_type
|
|
321
321
|
|
|
322
|
+
def get_ransomware_activities(self):
|
|
323
|
+
# type: () -> ClientResult[AnyStr]
|
|
324
|
+
""" """
|
|
325
|
+
return_type = ClientResult(self.context)
|
|
326
|
+
payload = {"parameters": RenderListDataParameters()}
|
|
327
|
+
qry = ServiceOperationQuery(
|
|
328
|
+
self, "GetRansomwareActivities", None, payload, None, return_type
|
|
329
|
+
)
|
|
330
|
+
self.context.add_query(qry)
|
|
331
|
+
return return_type
|
|
332
|
+
|
|
333
|
+
def get_sp_list_item_count(self, list_name):
|
|
334
|
+
# type: (str) -> ClientResult[int]
|
|
335
|
+
""" """
|
|
336
|
+
return_type = ClientResult(self.context)
|
|
337
|
+
payload = {"listName": list_name}
|
|
338
|
+
qry = ServiceOperationQuery(
|
|
339
|
+
self, "GetSPListItemCount", None, payload, None, return_type
|
|
340
|
+
)
|
|
341
|
+
self.context.add_query(qry)
|
|
342
|
+
return return_type
|
|
343
|
+
|
|
344
|
+
def get_sp_list_root_folder_properties(self, list_name):
|
|
345
|
+
# type: (str) -> ClientResult[dict]
|
|
346
|
+
""" """
|
|
347
|
+
return_type = ClientResult(self.context)
|
|
348
|
+
payload = {"listName": list_name}
|
|
349
|
+
qry = ServiceOperationQuery(
|
|
350
|
+
self, "GetSPListRootFolderProperties", None, payload, None, return_type
|
|
351
|
+
)
|
|
352
|
+
self.context.add_query(qry)
|
|
353
|
+
return return_type
|
|
354
|
+
|
|
355
|
+
def get_spo_all_web_templates(self, culture_name=None, compatibility_level=None):
|
|
356
|
+
# type: (str, int) -> SPOTenantWebTemplateCollection
|
|
357
|
+
""" """
|
|
358
|
+
return_type = SPOTenantWebTemplateCollection(self.context)
|
|
359
|
+
payload = {
|
|
360
|
+
"cultureName": culture_name,
|
|
361
|
+
"compatibilityLevel": compatibility_level,
|
|
362
|
+
}
|
|
363
|
+
qry = ServiceOperationQuery(
|
|
364
|
+
self, "GetSPOAllWebTemplates", None, payload, None, return_type
|
|
365
|
+
)
|
|
366
|
+
self.context.add_query(qry)
|
|
367
|
+
return return_type
|
|
368
|
+
|
|
322
369
|
def check_tenant_intune_license(self):
|
|
323
|
-
|
|
324
|
-
Checks whether a tenant has the Intune license.
|
|
325
|
-
|
|
326
|
-
return_type = ClientResult(self.context) # type: ClientResult[bool]
|
|
370
|
+
# type: () -> ClientResult[bool]
|
|
371
|
+
"""Checks whether a tenant has the Intune license."""
|
|
372
|
+
return_type = ClientResult(self.context)
|
|
327
373
|
qry = ServiceOperationQuery(
|
|
328
374
|
self, "CheckTenantIntuneLicense", None, None, None, return_type
|
|
329
375
|
)
|
|
File without changes
|
|
File without changes
|