Office365-REST-Python-Client 2.5.2__py3-none-any.whl → 2.5.4__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.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/METADATA +18 -5
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/RECORD +135 -131
- office365/base_item.py +12 -20
- office365/communications/presences/presence.py +18 -7
- office365/delta_path.py +1 -1
- office365/directory/administrative_unit.py +6 -7
- office365/directory/applications/application.py +15 -13
- office365/directory/applications/template.py +5 -8
- office365/directory/audit/signins/signin.py +8 -12
- office365/directory/authentication/methods/details.py +8 -6
- office365/directory/authentication/methods/email.py +4 -4
- office365/directory/groups/lifecycle_policy.py +8 -7
- office365/directory/identities/provider.py +5 -6
- office365/directory/internal/paths/me.py +1 -1
- office365/directory/permissions/email_identity.py +7 -0
- office365/directory/protection/riskyusers/history_item.py +4 -3
- office365/directory/rolemanagement/role.py +5 -4
- office365/directory/rolemanagement/template.py +2 -6
- office365/directory/rolemanagement/unified_role_assignment.py +5 -4
- office365/directory/rolemanagement/unified_role_definition.py +6 -4
- office365/directory/serviceprincipals/service_principal.py +11 -6
- office365/directory/users/user.py +8 -11
- office365/entity.py +2 -2
- office365/entity_collection.py +11 -4
- office365/intune/devices/enrollment/configuration.py +6 -4
- office365/intune/devices/managed.py +9 -12
- office365/onedrive/analytics/item_activity_stat.py +4 -3
- office365/onedrive/columns/definition.py +9 -9
- office365/onedrive/documentsets/version.py +1 -3
- office365/onedrive/driveitems/driveItem.py +36 -29
- office365/onedrive/internal/paths/children.py +2 -2
- office365/onedrive/internal/paths/root.py +1 -1
- office365/onedrive/internal/paths/shared.py +11 -6
- office365/onedrive/internal/paths/site.py +3 -3
- office365/onedrive/internal/paths/url.py +2 -2
- office365/onedrive/listitems/list_item.py +2 -0
- office365/onedrive/lists/list.py +7 -4
- office365/onedrive/permissions/collection.py +26 -6
- office365/onedrive/sharepoint.py +1 -0
- office365/onedrive/shares/collection.py +2 -5
- office365/onedrive/shares/drive_item.py +5 -1
- office365/onedrive/termstore/groups/collection.py +3 -8
- office365/onedrive/termstore/groups/group.py +8 -0
- office365/onedrive/termstore/sets/collection.py +2 -6
- office365/onedrive/termstore/sets/name.py +5 -0
- office365/onedrive/termstore/sets/set.py +7 -0
- office365/onedrive/termstore/store.py +10 -13
- office365/onedrive/versions/drive_item.py +6 -8
- office365/onedrive/workbooks/functions/result.py +1 -1
- office365/onedrive/workbooks/names/collection.py +26 -0
- office365/onedrive/workbooks/names/named_item.py +23 -6
- office365/onedrive/workbooks/ranges/range.py +61 -14
- office365/onedrive/workbooks/ranges/view.py +1 -0
- office365/onedrive/workbooks/tables/table.py +11 -8
- office365/onedrive/workbooks/workbook.py +7 -11
- office365/onedrive/workbooks/worksheets/worksheet.py +5 -3
- office365/onenote/pages/collection.py +3 -2
- office365/onenote/resources/resource.py +5 -4
- office365/onenote/sectiongroups/section_group.py +10 -7
- office365/outlook/calendar/calendar.py +1 -1
- office365/outlook/calendar/schedule/information.py +0 -1
- office365/outlook/contacts/contact.py +3 -9
- office365/outlook/contacts/folder.py +3 -0
- office365/outlook/item.py +3 -4
- office365/outlook/mail/messages/message.py +25 -18
- office365/outlook/mail/recipient.py +3 -1
- office365/runtime/auth/authentication_context.py +6 -4
- office365/runtime/auth/providers/acs_token_provider.py +21 -15
- office365/runtime/auth/providers/saml_token_provider.py +5 -2
- office365/runtime/auth/sts_profile.py +5 -2
- office365/runtime/client_object.py +3 -11
- office365/runtime/client_object_collection.py +22 -20
- office365/runtime/client_result.py +1 -3
- office365/runtime/client_value_collection.py +2 -6
- office365/runtime/odata/json_format.py +1 -5
- office365/runtime/odata/query_options.py +1 -3
- office365/runtime/odata/request.py +8 -13
- office365/runtime/odata/type.py +2 -0
- office365/runtime/paths/appid.py +1 -1
- office365/runtime/{odata/url_builder.py → paths/builder.py} +24 -9
- office365/runtime/paths/item.py +1 -1
- office365/runtime/paths/resource_path.py +12 -16
- office365/runtime/paths/service_operation.py +8 -7
- office365/runtime/paths/v3/__init__.py +0 -0
- office365/runtime/paths/{key.py → v3/entity.py} +5 -5
- office365/runtime/paths/v4/__init__.py +0 -0
- office365/runtime/paths/v4/entity.py +35 -0
- office365/sharepoint/client_context.py +17 -10
- office365/sharepoint/contenttypes/content_type.py +6 -0
- office365/sharepoint/documentmanagement/document_set.py +4 -6
- office365/sharepoint/entity_collection.py +9 -0
- office365/sharepoint/features/feature.py +6 -8
- office365/sharepoint/files/checked_out_file.py +4 -2
- office365/sharepoint/files/checked_out_file_collection.py +1 -1
- office365/sharepoint/files/collection.py +35 -3
- office365/sharepoint/files/file.py +35 -11
- office365/sharepoint/files/versions/collection.py +4 -0
- office365/sharepoint/files/versions/event.py +6 -3
- office365/sharepoint/files/versions/version.py +6 -4
- office365/sharepoint/folders/collection.py +2 -2
- office365/sharepoint/folders/folder.py +5 -11
- office365/sharepoint/internal/paths/static_operation.py +9 -0
- office365/sharepoint/internal/paths/web.py +20 -0
- office365/sharepoint/listitems/collection.py +4 -0
- office365/sharepoint/listitems/listitem.py +19 -30
- office365/sharepoint/lists/list.py +44 -60
- office365/sharepoint/portal/groups/service.py +12 -16
- office365/sharepoint/portal/groups/site_manager.py +0 -1
- office365/sharepoint/publishing/pages/metadata.py +7 -2
- office365/sharepoint/publishing/pages/metadata_collection.py +0 -1
- office365/sharepoint/publishing/pages/page.py +3 -6
- office365/sharepoint/publishing/pages/reposts/repost.py +5 -9
- office365/sharepoint/recyclebin/item.py +11 -9
- office365/sharepoint/sharing/links/share_response.py +3 -0
- office365/sharepoint/sharing/result.py +18 -41
- office365/sharepoint/sites/site.py +46 -68
- office365/sharepoint/taxonomy/item.py +4 -2
- office365/sharepoint/taxonomy/stores/store.py +2 -6
- office365/sharepoint/tenant/administration/internal/permission_grant.py +7 -0
- office365/sharepoint/tenant/administration/sites/properties.py +55 -44
- office365/sharepoint/tenant/administration/tenant.py +25 -40
- office365/sharepoint/usercustomactions/collection.py +0 -1
- office365/sharepoint/webs/collection.py +8 -0
- office365/sharepoint/webs/template_collection.py +2 -4
- office365/sharepoint/webs/web.py +27 -24
- office365/teams/apps/app.py +1 -0
- office365/teams/collection.py +12 -16
- office365/teams/members/conversation_collection.py +1 -3
- office365/teams/operations/async_operation.py +3 -5
- office365/teams/schedule/groups/group.py +3 -0
- office365/teams/team.py +1 -1
- office365/todo/attachments/base.py +7 -9
- office365/runtime/odata/path_builder.py +0 -23
- office365/runtime/paths/entity.py +0 -34
- office365/sharepoint/internal/key_value.py +0 -28
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import time
|
|
2
2
|
from typing import AnyStr, Optional
|
|
3
3
|
|
|
4
|
+
from typing_extensions import Self
|
|
5
|
+
|
|
4
6
|
from office365.runtime.client_result import ClientResult
|
|
5
7
|
from office365.runtime.client_value_collection import ClientValueCollection
|
|
6
8
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
@@ -9,6 +11,7 @@ from office365.sharepoint.entity import Entity
|
|
|
9
11
|
from office365.sharepoint.entity_collection import EntityCollection
|
|
10
12
|
from office365.sharepoint.gtp.request_options import ChatGptRequestOptions
|
|
11
13
|
from office365.sharepoint.listitems.collection import ListItemCollection
|
|
14
|
+
from office365.sharepoint.listitems.listitem import ListItem
|
|
12
15
|
from office365.sharepoint.lists.render_data_parameters import RenderListDataParameters
|
|
13
16
|
from office365.sharepoint.lists.render_override_parameters import (
|
|
14
17
|
RenderListDataOverrideParameters,
|
|
@@ -310,14 +313,11 @@ class Tenant(Entity):
|
|
|
310
313
|
self.context.add_query(qry)
|
|
311
314
|
return return_type
|
|
312
315
|
|
|
313
|
-
def
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
result = self.aggregated_site_collections_list.items.filter(
|
|
318
|
-
"SiteUrl eq '{0}'".format(url)
|
|
316
|
+
def get_site(self, site_url):
|
|
317
|
+
# type: (str) -> ListItem
|
|
318
|
+
return self._aggregated_site_collections_list.items.single(
|
|
319
|
+
"SiteUrl eq '{0}'".format(site_url.rstrip("/"))
|
|
319
320
|
).get()
|
|
320
|
-
return result
|
|
321
321
|
|
|
322
322
|
def get_sites_by_state(self, states=None):
|
|
323
323
|
"""
|
|
@@ -325,7 +325,7 @@ class Tenant(Entity):
|
|
|
325
325
|
"""
|
|
326
326
|
return_type = ListItemCollection(
|
|
327
327
|
self.context,
|
|
328
|
-
ResourcePath("items", self.
|
|
328
|
+
ResourcePath("items", self._aggregated_site_collections_list.resource_path),
|
|
329
329
|
)
|
|
330
330
|
payload = {"states": states}
|
|
331
331
|
qry = ServiceOperationQuery(
|
|
@@ -424,11 +424,8 @@ class Tenant(Entity):
|
|
|
424
424
|
return self
|
|
425
425
|
|
|
426
426
|
def register_hub_site(self, site_url):
|
|
427
|
-
|
|
428
|
-
Registers an existing site as a hub site.
|
|
429
|
-
|
|
430
|
-
:param str site_url:
|
|
431
|
-
"""
|
|
427
|
+
# type: (str) -> HubSiteProperties
|
|
428
|
+
"""Registers an existing site as a hub site."""
|
|
432
429
|
return_type = HubSiteProperties(self.context)
|
|
433
430
|
params = {"siteUrl": site_url}
|
|
434
431
|
qry = ServiceOperationQuery(
|
|
@@ -438,11 +435,8 @@ class Tenant(Entity):
|
|
|
438
435
|
return return_type
|
|
439
436
|
|
|
440
437
|
def unregister_hub_site(self, site_url):
|
|
441
|
-
|
|
442
|
-
Unregisters a hub site so that it is no longer a hub site.
|
|
443
|
-
|
|
444
|
-
:param str site_url: Site Url
|
|
445
|
-
"""
|
|
438
|
+
# type: (str) -> Self
|
|
439
|
+
"""Unregisters a hub site so that it is no longer a hub site."""
|
|
446
440
|
payload = {"siteUrl": site_url}
|
|
447
441
|
qry = ServiceOperationQuery(
|
|
448
442
|
self, "UnregisterHubSite", None, payload, None, None
|
|
@@ -526,7 +520,6 @@ class Tenant(Entity):
|
|
|
526
520
|
|
|
527
521
|
def restore_deleted_site(self, site_url):
|
|
528
522
|
"""Restores deleted site with the specified URL
|
|
529
|
-
|
|
530
523
|
:param str site_url: A string representing the URL of the site.
|
|
531
524
|
"""
|
|
532
525
|
return_type = SpoOperation(self.context)
|
|
@@ -543,6 +536,7 @@ class Tenant(Entity):
|
|
|
543
536
|
:param bool include_detail: A Boolean value that indicates whether to include all of the SPSite properties.
|
|
544
537
|
"""
|
|
545
538
|
return_type = SiteProperties(self.context)
|
|
539
|
+
return_type.set_property("Url", url, False)
|
|
546
540
|
self.sites.add_child(return_type)
|
|
547
541
|
payload = {"url": url, "includeDetail": include_detail}
|
|
548
542
|
qry = ServiceOperationQuery(
|
|
@@ -574,12 +568,8 @@ class Tenant(Entity):
|
|
|
574
568
|
return return_type
|
|
575
569
|
|
|
576
570
|
def connect_site_to_hub_site_by_id(self, site_url, hub_site_id):
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
:param str site_url:
|
|
580
|
-
:param str hub_site_id:
|
|
581
|
-
:return:
|
|
582
|
-
"""
|
|
571
|
+
# type: (str, str) -> Self
|
|
572
|
+
"""Connects Site to Hub Site"""
|
|
583
573
|
params = {"siteUrl": site_url, "hubSiteId": hub_site_id}
|
|
584
574
|
qry = ServiceOperationQuery(
|
|
585
575
|
self, "ConnectSiteToHubSiteById", None, params, None, None
|
|
@@ -588,9 +578,8 @@ class Tenant(Entity):
|
|
|
588
578
|
return self
|
|
589
579
|
|
|
590
580
|
def send_email(self, site_url):
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
"""
|
|
581
|
+
# type: (str) -> ClientResult[bool]
|
|
582
|
+
""" """
|
|
594
583
|
return_type = ClientResult(self.context, bool())
|
|
595
584
|
payload = {"siteUrl": site_url}
|
|
596
585
|
qry = ServiceOperationQuery(self, "SendEmail", None, payload, None, return_type)
|
|
@@ -599,10 +588,8 @@ class Tenant(Entity):
|
|
|
599
588
|
|
|
600
589
|
@property
|
|
601
590
|
def ai_builder_enabled(self):
|
|
602
|
-
|
|
603
|
-
Gets the value if the AIBuilder settings should be shown in the tenant
|
|
604
|
-
:rtype: bool or None
|
|
605
|
-
"""
|
|
591
|
+
# type: () -> Optional[str]
|
|
592
|
+
"""Gets the value if the AIBuilder settings should be shown in the tenant"""
|
|
606
593
|
return self.properties.get("AIBuilderEnabled", None)
|
|
607
594
|
|
|
608
595
|
@property
|
|
@@ -613,26 +600,26 @@ class Tenant(Entity):
|
|
|
613
600
|
)
|
|
614
601
|
|
|
615
602
|
@property
|
|
616
|
-
def
|
|
603
|
+
def _aggregated_site_collections_list(self):
|
|
617
604
|
return self.context.web.lists.get_by_title(
|
|
618
605
|
"DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS"
|
|
619
606
|
)
|
|
620
607
|
|
|
621
608
|
@property
|
|
622
609
|
def allow_comments_text_on_email_enabled(self):
|
|
610
|
+
# type: () -> Optional[bool]
|
|
623
611
|
"""
|
|
624
612
|
When enabled, the email notification that a user receives when is mentioned,
|
|
625
|
-
|
|
626
|
-
:rtype: bool or None
|
|
613
|
+
includes the surrounding document context
|
|
627
614
|
"""
|
|
628
615
|
return self.properties.get("AllowCommentsTextOnEmailEnabled", None)
|
|
629
616
|
|
|
630
617
|
@property
|
|
631
618
|
def allow_everyone_except_external_users_claim_in_private_site(self):
|
|
619
|
+
# type: () -> Optional[bool]
|
|
632
620
|
"""
|
|
633
621
|
Gets the value if EveryoneExceptExternalUsers claim is allowed or not in people picker in a private group site.
|
|
634
622
|
False value means it is blocked
|
|
635
|
-
:rtype: bool or None
|
|
636
623
|
"""
|
|
637
624
|
return self.properties.get(
|
|
638
625
|
"AllowEveryoneExceptExternalUsersClaimInPrivateSite", None
|
|
@@ -640,10 +627,10 @@ class Tenant(Entity):
|
|
|
640
627
|
|
|
641
628
|
@property
|
|
642
629
|
def allow_editing(self):
|
|
630
|
+
# type: () -> Optional[bool]
|
|
643
631
|
"""
|
|
644
632
|
Prevents users from editing Office files in the browser and copying and pasting Office file contents
|
|
645
633
|
out of the browser window.
|
|
646
|
-
:rtype: bool or None
|
|
647
634
|
"""
|
|
648
635
|
return self.properties.get("AllowEditing", None)
|
|
649
636
|
|
|
@@ -655,9 +642,7 @@ class Tenant(Entity):
|
|
|
655
642
|
@property
|
|
656
643
|
def root_site_url(self):
|
|
657
644
|
# type: () -> Optional[str]
|
|
658
|
-
"""
|
|
659
|
-
The tenant's root site url
|
|
660
|
-
"""
|
|
645
|
+
"""The tenant's root site url"""
|
|
661
646
|
return self.properties.get("RootSiteUrl", None)
|
|
662
647
|
|
|
663
648
|
@property
|
|
@@ -13,7 +13,6 @@ class UserCustomActionCollection(EntityCollection[UserCustomAction]):
|
|
|
13
13
|
def clear(self):
|
|
14
14
|
"""
|
|
15
15
|
Deletes all custom actions in the collection.
|
|
16
|
-
|
|
17
16
|
Exceptions:
|
|
18
17
|
- 2130575305 Microsoft.SharePoint.SPException Custom action was modified on the server in a way that
|
|
19
18
|
prevents changes from being committed, as determined by the protocol server.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
2
2
|
from office365.sharepoint.entity_collection import EntityCollection
|
|
3
|
+
from office365.sharepoint.internal.paths.web import WebPath
|
|
3
4
|
from office365.sharepoint.webs.web import Web
|
|
4
5
|
|
|
5
6
|
|
|
@@ -25,6 +26,13 @@ class WebCollection(EntityCollection[Web]):
|
|
|
25
26
|
self.context.add_query(qry)
|
|
26
27
|
return return_type
|
|
27
28
|
|
|
29
|
+
def create_typed_object(self, initial_properties=None, resource_path=None):
|
|
30
|
+
if resource_path is None:
|
|
31
|
+
resource_path = WebPath(self.resource_path)
|
|
32
|
+
return super(EntityCollection, self).create_typed_object(
|
|
33
|
+
initial_properties, resource_path
|
|
34
|
+
)
|
|
35
|
+
|
|
28
36
|
@property
|
|
29
37
|
def resource_url(self):
|
|
30
38
|
val = super(WebCollection, self).resource_url
|
|
@@ -12,10 +12,8 @@ class WebTemplateCollection(EntityCollection[WebTemplate]):
|
|
|
12
12
|
)
|
|
13
13
|
|
|
14
14
|
def get_by_name(self, name):
|
|
15
|
-
"""Returns the SP.WebTemplate (section 3.2.5.151) specified by its name
|
|
16
|
-
|
|
17
|
-
:param str name: The name of the SP.WebTemplate that is returned.
|
|
18
|
-
|
|
15
|
+
"""Returns the SP.WebTemplate (section 3.2.5.151) specified by its name.
|
|
16
|
+
:param str name: The name of the WebTemplate that is returned.
|
|
19
17
|
"""
|
|
20
18
|
return WebTemplate(
|
|
21
19
|
self.context,
|
office365/sharepoint/webs/web.py
CHANGED
|
@@ -41,6 +41,7 @@ from office365.sharepoint.files.file import File
|
|
|
41
41
|
from office365.sharepoint.flows.synchronization_result import FlowSynchronizationResult
|
|
42
42
|
from office365.sharepoint.folders.collection import FolderCollection
|
|
43
43
|
from office365.sharepoint.folders.folder import Folder
|
|
44
|
+
from office365.sharepoint.internal.paths.web import WebPath
|
|
44
45
|
from office365.sharepoint.listitems.listitem import ListItem
|
|
45
46
|
from office365.sharepoint.lists.collection import ListCollection
|
|
46
47
|
from office365.sharepoint.lists.creation_information import ListCreationInformation
|
|
@@ -123,10 +124,13 @@ class Web(SecurableObject):
|
|
|
123
124
|
:type context: office365.sharepoint.client_context.ClientContext
|
|
124
125
|
"""
|
|
125
126
|
if resource_path is None:
|
|
126
|
-
resource_path =
|
|
127
|
+
resource_path = WebPath("Web")
|
|
127
128
|
super(Web, self).__init__(context, resource_path)
|
|
128
129
|
self._web_url = None
|
|
129
130
|
|
|
131
|
+
def __str__(self):
|
|
132
|
+
return self.title
|
|
133
|
+
|
|
130
134
|
def add_list(self, title, template_type=ListTemplateType.GenericList):
|
|
131
135
|
"""
|
|
132
136
|
Creates a new list and adds it to the web.
|
|
@@ -576,7 +580,7 @@ class Web(SecurableObject):
|
|
|
576
580
|
:type webs: office365.sharepoint.webs.collection.WebCollection
|
|
577
581
|
:type all_webs: office365.sharepoint.webs.collection.WebCollection
|
|
578
582
|
"""
|
|
579
|
-
for cur_web in webs:
|
|
583
|
+
for cur_web in webs:
|
|
580
584
|
all_webs.add_child(cur_web)
|
|
581
585
|
|
|
582
586
|
def _webs_loaded(web):
|
|
@@ -1098,7 +1102,6 @@ class Web(SecurableObject):
|
|
|
1098
1102
|
def get_file_by_guest_url(self, guest_url):
|
|
1099
1103
|
"""
|
|
1100
1104
|
Returns the file object from the guest access URL.
|
|
1101
|
-
|
|
1102
1105
|
:param str guest_url: The guest access URL to get the file with.
|
|
1103
1106
|
"""
|
|
1104
1107
|
return_type = File(self.context)
|
|
@@ -1201,7 +1204,7 @@ class Web(SecurableObject):
|
|
|
1201
1204
|
|
|
1202
1205
|
:param str guest_url: The tokenized sharing link URL for the folder.
|
|
1203
1206
|
"""
|
|
1204
|
-
return_type = Folder(self.context)
|
|
1207
|
+
return_type = Folder(self.context, parent_collection=self.folders)
|
|
1205
1208
|
payload = {"guestUrl": guest_url}
|
|
1206
1209
|
qry = ServiceOperationQuery(
|
|
1207
1210
|
self, "GetFolderByGuestUrl", None, payload, None, return_type
|
|
@@ -1225,7 +1228,7 @@ class Web(SecurableObject):
|
|
|
1225
1228
|
:param bool ensure_access: Indicates if the request to the tokenized sharing link grants perpetual access to
|
|
1226
1229
|
the calling user.
|
|
1227
1230
|
"""
|
|
1228
|
-
return_type = Folder(self.context)
|
|
1231
|
+
return_type = Folder(self.context, parent_collection=self.folders)
|
|
1229
1232
|
payload = {
|
|
1230
1233
|
"guestUrl": guest_url,
|
|
1231
1234
|
"requestSettings": SharingLinkAccessRequest(ensure_access, password),
|
|
@@ -1282,9 +1285,10 @@ class Web(SecurableObject):
|
|
|
1282
1285
|
"""
|
|
1283
1286
|
return_type = SharingResult(self.context)
|
|
1284
1287
|
|
|
1285
|
-
def
|
|
1288
|
+
def _share(picker_result, group):
|
|
1289
|
+
# type: (ClientResult[str], Group) -> None
|
|
1286
1290
|
picker_input = "[{0}]".format(picker_result.value)
|
|
1287
|
-
role_value = "group:{groupId}".format(groupId=group.
|
|
1291
|
+
role_value = "group:{groupId}".format(groupId=group.id)
|
|
1288
1292
|
Web.share_object(
|
|
1289
1293
|
self.context,
|
|
1290
1294
|
self.url,
|
|
@@ -1299,26 +1303,26 @@ class Web(SecurableObject):
|
|
|
1299
1303
|
return_type=return_type,
|
|
1300
1304
|
)
|
|
1301
1305
|
|
|
1302
|
-
def _grp_resolved(group):
|
|
1303
|
-
picker_result = (
|
|
1304
|
-
ClientPeoplePickerWebServiceInterface.client_people_picker_resolve_user(
|
|
1305
|
-
self.context, user_principal_name
|
|
1306
|
-
)
|
|
1307
|
-
)
|
|
1308
|
-
self.context.after_execute(
|
|
1309
|
-
_picker_value_resolved, True, picker_result, group
|
|
1310
|
-
)
|
|
1311
|
-
|
|
1312
1306
|
def _web_resolved():
|
|
1313
1307
|
groups = {
|
|
1314
1308
|
ExternalSharingSiteOption.View: self.associated_visitor_group,
|
|
1315
1309
|
ExternalSharingSiteOption.Edit: self.associated_member_group,
|
|
1316
1310
|
ExternalSharingSiteOption.Owner: self.associated_owner_group,
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1311
|
+
} # type: dict[ExternalSharingSiteOption, Group]
|
|
1312
|
+
|
|
1313
|
+
ClientPeoplePickerWebServiceInterface.client_people_picker_resolve_user(
|
|
1314
|
+
self.context, user_principal_name
|
|
1315
|
+
).after_execute(_share, groups[share_option])
|
|
1320
1316
|
|
|
1321
|
-
self.
|
|
1317
|
+
self.ensure_properties(
|
|
1318
|
+
[
|
|
1319
|
+
"Url",
|
|
1320
|
+
"AssociatedVisitorGroup",
|
|
1321
|
+
"AssociatedMemberGroup",
|
|
1322
|
+
"AssociatedOwnerGroup",
|
|
1323
|
+
],
|
|
1324
|
+
_web_resolved,
|
|
1325
|
+
)
|
|
1322
1326
|
return return_type
|
|
1323
1327
|
|
|
1324
1328
|
def unshare(self):
|
|
@@ -2380,9 +2384,7 @@ class Web(SecurableObject):
|
|
|
2380
2384
|
|
|
2381
2385
|
@property
|
|
2382
2386
|
def server_relative_path(self):
|
|
2383
|
-
"""
|
|
2384
|
-
Gets the server-relative Path of the Web.
|
|
2385
|
-
"""
|
|
2387
|
+
"""Gets the server-relative Path of the Web."""
|
|
2386
2388
|
return self.properties.get("ServerRelativePath", SPResPath())
|
|
2387
2389
|
|
|
2388
2390
|
@property
|
|
@@ -2450,6 +2452,7 @@ class Web(SecurableObject):
|
|
|
2450
2452
|
super(Web, self).set_property(name, value, persist_changes)
|
|
2451
2453
|
if name == "Url":
|
|
2452
2454
|
self._web_url = value
|
|
2455
|
+
self._resource_path.patch(value)
|
|
2453
2456
|
return self
|
|
2454
2457
|
|
|
2455
2458
|
@property
|
office365/teams/apps/app.py
CHANGED
office365/teams/collection.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from typing import Callable
|
|
2
2
|
|
|
3
|
+
import requests
|
|
3
4
|
from typing_extensions import Self
|
|
4
5
|
|
|
5
|
-
from office365.directory.groups.group import Group
|
|
6
6
|
from office365.entity_collection import EntityCollection
|
|
7
|
-
from office365.runtime.
|
|
7
|
+
from office365.runtime.paths.builder import ODataPathBuilder
|
|
8
8
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
9
9
|
from office365.runtime.queries.create_entity import CreateEntityQuery
|
|
10
10
|
from office365.teams.operations.async_operation import TeamsAsyncOperation
|
|
@@ -44,26 +44,22 @@ class TeamCollection(EntityCollection[Team]):
|
|
|
44
44
|
return_type = Team(self.context)
|
|
45
45
|
self.add_child(return_type)
|
|
46
46
|
|
|
47
|
-
payload = {
|
|
48
|
-
"displayName": display_name,
|
|
49
|
-
"description": description,
|
|
50
|
-
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
|
|
51
|
-
}
|
|
52
|
-
qry = CreateEntityQuery(self, payload, return_type)
|
|
53
|
-
self.context.add_query(qry)
|
|
54
|
-
|
|
55
47
|
def _process_response(resp):
|
|
56
|
-
|
|
57
|
-
:type resp: requests.Response
|
|
58
|
-
"""
|
|
48
|
+
# type: (requests.Response) -> None
|
|
59
49
|
content_loc = resp.headers.get("Content-Location", None)
|
|
60
|
-
team_path = ODataPathBuilder.
|
|
50
|
+
team_path = ODataPathBuilder.parse_url(content_loc)
|
|
61
51
|
return_type.set_property("id", team_path.segment, False)
|
|
62
52
|
|
|
63
53
|
loc = resp.headers.get("Location", None)
|
|
64
|
-
operation_path = ODataPathBuilder.
|
|
54
|
+
operation_path = ODataPathBuilder.parse_url(loc)
|
|
65
55
|
operation = TeamsAsyncOperation(self.context, operation_path)
|
|
66
56
|
return_type.operations.add_child(operation)
|
|
67
57
|
|
|
68
|
-
|
|
58
|
+
payload = {
|
|
59
|
+
"displayName": display_name,
|
|
60
|
+
"description": description,
|
|
61
|
+
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
|
|
62
|
+
}
|
|
63
|
+
qry = CreateEntityQuery(self, payload, return_type)
|
|
64
|
+
self.context.add_query(qry).after_execute(_process_response)
|
|
69
65
|
return return_type
|
|
@@ -2,7 +2,7 @@ from office365.entity_collection import EntityCollection
|
|
|
2
2
|
from office365.teams.members.conversation import ConversationMember
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
class ConversationMemberCollection(EntityCollection):
|
|
5
|
+
class ConversationMemberCollection(EntityCollection[ConversationMember]):
|
|
6
6
|
def __init__(self, context, resource_path=None):
|
|
7
7
|
super(ConversationMemberCollection, self).__init__(
|
|
8
8
|
context, ConversationMember, resource_path
|
|
@@ -18,8 +18,6 @@ class ConversationMemberCollection(EntityCollection):
|
|
|
18
18
|
Each member must be assigned a role of owner or guest. Guest tenant members must be assigned the guest role
|
|
19
19
|
:param list[str] roles: The roles for that user.
|
|
20
20
|
:param datetime.datetime visible_history_start_datetime:
|
|
21
|
-
|
|
22
|
-
:rtype: ConversationMember
|
|
23
21
|
"""
|
|
24
22
|
return_type = super(ConversationMemberCollection, self).add(roles=roles)
|
|
25
23
|
from office365.directory.users.user import User
|
|
@@ -68,16 +68,14 @@ class TeamsAsyncOperation(Entity):
|
|
|
68
68
|
|
|
69
69
|
@property
|
|
70
70
|
def target_resource_location(self):
|
|
71
|
+
# type: () -> Optional[str]
|
|
71
72
|
"""The location of the object that's created or modified as result of this async operation.
|
|
72
73
|
This URL should be treated as an opaque value and not parsed into its component paths.
|
|
73
|
-
:rtype: str or None
|
|
74
74
|
"""
|
|
75
75
|
return self.properties.get("targetResourceLocation", None)
|
|
76
76
|
|
|
77
77
|
@property
|
|
78
78
|
def status(self):
|
|
79
|
-
|
|
80
|
-
Operation status.
|
|
81
|
-
:rtype: str
|
|
82
|
-
"""
|
|
79
|
+
# type: () -> Optional[str]
|
|
80
|
+
"""Operation status."""
|
|
83
81
|
return self.properties.get("status", None)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.runtime.types.collections import StringCollection
|
|
2
4
|
from office365.teams.schedule.change_tracked_entity import ChangeTrackedEntity
|
|
3
5
|
|
|
@@ -7,6 +9,7 @@ class SchedulingGroup(ChangeTrackedEntity):
|
|
|
7
9
|
|
|
8
10
|
@property
|
|
9
11
|
def is_active(self):
|
|
12
|
+
# type: () -> Optional[bool]
|
|
10
13
|
"""Indicates whether the schedulingGroup can be used when creating new entities or updating existing ones"""
|
|
11
14
|
return self.properties.get("isActive", None)
|
|
12
15
|
|
office365/teams/team.py
CHANGED
|
@@ -321,6 +321,6 @@ class Team(Entity):
|
|
|
321
321
|
def set_property(self, name, value, persist_changes=True):
|
|
322
322
|
super(Team, self).set_property(name, value, persist_changes)
|
|
323
323
|
# fallback: determine whether resource path is resolved
|
|
324
|
-
if name == "id" and self._resource_path.
|
|
324
|
+
if name == "id" and self._resource_path.segment == "team":
|
|
325
325
|
self._resource_path = ResourcePath(value, ResourcePath("teams"))
|
|
326
326
|
return self
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import datetime
|
|
2
|
+
from typing import Optional
|
|
2
3
|
|
|
3
4
|
from office365.entity import Entity
|
|
4
5
|
|
|
@@ -9,14 +10,13 @@ class AttachmentBase(Entity):
|
|
|
9
10
|
|
|
10
11
|
@property
|
|
11
12
|
def content_type(self):
|
|
12
|
-
|
|
13
|
-
The MIME type.
|
|
14
|
-
:rtype: str or None
|
|
15
|
-
"""
|
|
13
|
+
# type: () -> Optional[str]
|
|
14
|
+
"""The MIME type."""
|
|
16
15
|
return self.properties.get("contentType", None)
|
|
17
16
|
|
|
18
17
|
@property
|
|
19
18
|
def last_modified_datetime(self):
|
|
19
|
+
# type: () -> Optional[datetime.datetime]
|
|
20
20
|
"""
|
|
21
21
|
The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time.
|
|
22
22
|
"""
|
|
@@ -24,16 +24,14 @@ class AttachmentBase(Entity):
|
|
|
24
24
|
|
|
25
25
|
@property
|
|
26
26
|
def name(self):
|
|
27
|
+
# type: () -> Optional[str]
|
|
27
28
|
"""
|
|
28
29
|
The display name of the attachment. This does not need to be the actual file name.
|
|
29
|
-
:rtype: str or None
|
|
30
30
|
"""
|
|
31
31
|
return self.properties.get("name", None)
|
|
32
32
|
|
|
33
33
|
@property
|
|
34
34
|
def size(self):
|
|
35
|
-
|
|
36
|
-
The length of the attachment in bytes.
|
|
37
|
-
:rtype: int or None
|
|
38
|
-
"""
|
|
35
|
+
# type: () -> Optional[int]
|
|
36
|
+
"""The length of the attachment in bytes."""
|
|
39
37
|
return self.properties.get("size", None)
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import re
|
|
3
|
-
|
|
4
|
-
from office365.runtime.client_value import ClientValue
|
|
5
|
-
from office365.runtime.compat import is_string_type
|
|
6
|
-
from office365.runtime.paths.resource_path import ResourcePath
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ODataPathBuilder(object):
|
|
10
|
-
@staticmethod
|
|
11
|
-
def parse(path_str):
|
|
12
|
-
"""
|
|
13
|
-
Parses path from a string
|
|
14
|
-
|
|
15
|
-
:param str path_str:
|
|
16
|
-
"""
|
|
17
|
-
segments = [n for n in re.split(r"[('')]|/", path_str) if n]
|
|
18
|
-
if not segments:
|
|
19
|
-
raise TypeError("Invalid path")
|
|
20
|
-
path = None
|
|
21
|
-
for segment in segments:
|
|
22
|
-
path = ResourcePath(segment, path)
|
|
23
|
-
return path
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from office365.runtime.paths.resource_path import ResourcePath
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class EntityPath(ResourcePath):
|
|
5
|
-
def __init__(self, key=None, parent=None, collection=None):
|
|
6
|
-
"""
|
|
7
|
-
:param str or None key: Entity key
|
|
8
|
-
:param ResourcePath or None collection:
|
|
9
|
-
"""
|
|
10
|
-
super(EntityPath, self).__init__(key, parent)
|
|
11
|
-
self._collection = collection
|
|
12
|
-
|
|
13
|
-
@property
|
|
14
|
-
def collection(self):
|
|
15
|
-
return self._collection
|
|
16
|
-
|
|
17
|
-
@property
|
|
18
|
-
def segment(self):
|
|
19
|
-
return str(self.key or "<key>")
|
|
20
|
-
|
|
21
|
-
def patch(self, key, inplace=False):
|
|
22
|
-
"""
|
|
23
|
-
Patches path
|
|
24
|
-
|
|
25
|
-
:type key: str or None
|
|
26
|
-
:type inplace: bool
|
|
27
|
-
"""
|
|
28
|
-
if inplace:
|
|
29
|
-
self._key = key
|
|
30
|
-
self._parent = self.collection
|
|
31
|
-
self.__class__ = ResourcePath
|
|
32
|
-
return self
|
|
33
|
-
else:
|
|
34
|
-
return ResourcePath(key, self.collection)
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
from office365.runtime.client_value import ClientValue
|
|
2
|
-
from office365.runtime.client_value_collection import ClientValueCollection
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class KeyValue(ClientValue):
|
|
6
|
-
"""Represents a key value pair."""
|
|
7
|
-
|
|
8
|
-
def __init__(self, key=None, value=None, value_type=None):
|
|
9
|
-
"""
|
|
10
|
-
:param str key: The value of the key in the key value pair.
|
|
11
|
-
:param str value: The string representation of the value in the key value pair.
|
|
12
|
-
:param str value_type: The EDM type name of the value in the key value pair.
|
|
13
|
-
"""
|
|
14
|
-
self.Key = key
|
|
15
|
-
self.Value = value
|
|
16
|
-
self.ValueType = value_type
|
|
17
|
-
|
|
18
|
-
@property
|
|
19
|
-
def entity_type_name(self):
|
|
20
|
-
return "SP.KeyValue"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class KeyValueCollection(ClientValueCollection):
|
|
24
|
-
def __init__(self, initial_values=None):
|
|
25
|
-
"""
|
|
26
|
-
:type initial_values: list[KeyValue] or None
|
|
27
|
-
"""
|
|
28
|
-
super(KeyValueCollection, self).__init__(KeyValue, initial_values)
|
|
File without changes
|
{Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|