Office365-REST-Python-Client 2.5.2__py3-none-any.whl → 2.5.3__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.3.dist-info}/METADATA +4 -4
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/RECORD +122 -119
- 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/audit/signins/signin.py +8 -12
- office365/directory/authentication/methods/details.py +8 -6
- 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/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 +30 -29
- office365/onedrive/internal/paths/children.py +2 -2
- office365/onedrive/internal/paths/root.py +1 -1
- office365/onedrive/internal/paths/shared.py +1 -1
- 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 +3 -0
- 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 +3 -1
- office365/onedrive/workbooks/ranges/range.py +9 -13
- office365/onedrive/workbooks/ranges/view.py +1 -0
- office365/onedrive/workbooks/tables/table.py +1 -3
- 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/mail/messages/message.py +25 -18
- office365/outlook/mail/recipient.py +3 -1
- office365/runtime/auth/authentication_context.py +2 -2
- office365/runtime/auth/providers/acs_token_provider.py +7 -9
- 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/query_options.py +1 -3
- 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/{entity.py → v4/entity.py} +13 -11
- 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/sharepoint/internal/key_value.py +0 -28
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/top_level.txt +0 -0
|
@@ -109,7 +109,7 @@ class Site(Entity):
|
|
|
109
109
|
return ClientContext(url).site
|
|
110
110
|
|
|
111
111
|
def get_available_tags(self):
|
|
112
|
-
""""""
|
|
112
|
+
""" """
|
|
113
113
|
return_type = ClientResult(self.context, ClientValueCollection(ComplianceTag))
|
|
114
114
|
|
|
115
115
|
def _site_loaded():
|
|
@@ -130,9 +130,7 @@ class Site(Entity):
|
|
|
130
130
|
return return_type
|
|
131
131
|
|
|
132
132
|
def get_site_logo(self):
|
|
133
|
-
"""
|
|
134
|
-
Downloads a site logo
|
|
135
|
-
"""
|
|
133
|
+
"""Downloads a site logo"""
|
|
136
134
|
return_type = ClientResult(self.context)
|
|
137
135
|
|
|
138
136
|
def _site_loaded():
|
|
@@ -143,6 +141,18 @@ class Site(Entity):
|
|
|
143
141
|
self.ensure_property("Url", _site_loaded)
|
|
144
142
|
return return_type
|
|
145
143
|
|
|
144
|
+
def get_site_logo_ex(self):
|
|
145
|
+
"""Gets site logo image"""
|
|
146
|
+
return_type = ClientResult(self.context)
|
|
147
|
+
|
|
148
|
+
def _site_loaded():
|
|
149
|
+
self.context.group_service.get_group_image(
|
|
150
|
+
group_id=self.group_id, return_type=return_type
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
self.ensure_property("GroupId", _site_loaded)
|
|
154
|
+
return return_type
|
|
155
|
+
|
|
146
156
|
def set_site_logo(self, relative_logo_url):
|
|
147
157
|
"""Uploads a site logo
|
|
148
158
|
|
|
@@ -153,9 +163,7 @@ class Site(Entity):
|
|
|
153
163
|
return self
|
|
154
164
|
|
|
155
165
|
def is_comm_site(self):
|
|
156
|
-
"""
|
|
157
|
-
Determines whether a site is communication site
|
|
158
|
-
"""
|
|
166
|
+
"""Determines whether a site is communication site"""
|
|
159
167
|
return_type = ClientResult(self.context) # type: ClientResult[bool]
|
|
160
168
|
|
|
161
169
|
def _site_loaded():
|
|
@@ -165,9 +173,7 @@ class Site(Entity):
|
|
|
165
173
|
return return_type
|
|
166
174
|
|
|
167
175
|
def is_valid_home_site(self):
|
|
168
|
-
"""
|
|
169
|
-
Determines whether a site is landing site for your intranet.
|
|
170
|
-
"""
|
|
176
|
+
"""Determines whether a site is landing site for your intranet."""
|
|
171
177
|
return_type = ClientResult(self.context) # type: ClientResult[bool]
|
|
172
178
|
|
|
173
179
|
def _site_loaded():
|
|
@@ -177,9 +183,7 @@ class Site(Entity):
|
|
|
177
183
|
return return_type
|
|
178
184
|
|
|
179
185
|
def set_as_home_site(self):
|
|
180
|
-
"""
|
|
181
|
-
Sets a site as a landing site for your intranet.
|
|
182
|
-
"""
|
|
186
|
+
"""Sets a site as a landing site for your intranet."""
|
|
183
187
|
return_type = ClientResult(self.context)
|
|
184
188
|
|
|
185
189
|
def _site_loaded():
|
|
@@ -438,9 +442,7 @@ class Site(Entity):
|
|
|
438
442
|
return return_type
|
|
439
443
|
|
|
440
444
|
def unregister_hub_site(self):
|
|
441
|
-
"""
|
|
442
|
-
Disables the hub site feature on a site.
|
|
443
|
-
"""
|
|
445
|
+
"""Disables the hub site feature on a site."""
|
|
444
446
|
qry = ServiceOperationQuery(self, "UnRegisterHubSite")
|
|
445
447
|
self.context.add_query(qry)
|
|
446
448
|
return self
|
|
@@ -464,93 +466,80 @@ class Site(Entity):
|
|
|
464
466
|
|
|
465
467
|
@property
|
|
466
468
|
def allow_create_declarative_workflow(self):
|
|
467
|
-
|
|
468
|
-
Specifies whether a designer can be used to create declarative workflows on this site collection
|
|
469
|
-
:rtype: bool or None
|
|
470
|
-
"""
|
|
469
|
+
# type: () -> Optional[bool]
|
|
470
|
+
"""Specifies whether a designer can be used to create declarative workflows on this site collection"""
|
|
471
471
|
return self.properties.get("AllowCreateDeclarativeWorkflow", None)
|
|
472
472
|
|
|
473
473
|
@property
|
|
474
474
|
def allow_designer(self):
|
|
475
|
+
# type: () -> Optional[bool]
|
|
475
476
|
"""
|
|
476
477
|
Specifies whether a designer can be used on this site collection.
|
|
477
478
|
See Microsoft.SharePoint.Client.Web.AllowDesignerForCurrentUser, which is the scalar property used
|
|
478
479
|
to determine the behavior for the current user. The default, if not disabled on the Web application, is "true".
|
|
479
|
-
:rtype: bool or None
|
|
480
480
|
"""
|
|
481
481
|
return self.properties.get("AllowDesigner", None)
|
|
482
482
|
|
|
483
483
|
@property
|
|
484
484
|
def allowed_external_domains(self):
|
|
485
|
-
|
|
486
|
-
:rtype: bool or None
|
|
487
|
-
"""
|
|
485
|
+
# type: () -> Optional[bool]
|
|
488
486
|
return self.properties.get("AllowedExternalDomains", None)
|
|
489
487
|
|
|
490
488
|
@property
|
|
491
489
|
def allow_master_page_editing(self):
|
|
490
|
+
# type: () -> Optional[bool]
|
|
492
491
|
"""
|
|
493
492
|
Specifies whether master page editing is allowed on this site collection.
|
|
494
493
|
See Web.AllowMasterPageEditingForCurrentUser, which is the scalar property used to
|
|
495
494
|
determine the behavior for the current user. The default, if not disabled on the Web application, is "false".
|
|
496
|
-
:rtype: bool or None
|
|
497
495
|
"""
|
|
498
496
|
return self.properties.get("AllowMasterPageEditing", None)
|
|
499
497
|
|
|
500
498
|
@property
|
|
501
499
|
def allow_revert_from_template(self):
|
|
500
|
+
# type: () -> Optional[bool]
|
|
502
501
|
"""
|
|
503
502
|
Specifies whether this site collection can be reverted to its base template.
|
|
504
503
|
See Web.AllowRevertFromTemplateForCurrentUser, which is the scalar property used to determine the behavior
|
|
505
504
|
for the current user. The default, if not disabled on the Web application, is "false".
|
|
506
|
-
:rtype: bool or None
|
|
507
505
|
"""
|
|
508
506
|
return self.properties.get("AllowRevertFromTemplate", None)
|
|
509
507
|
|
|
510
508
|
@property
|
|
511
509
|
def audit(self):
|
|
512
|
-
"""
|
|
513
|
-
Enables auditing of how site collection is accessed, changed, and used.
|
|
514
|
-
"""
|
|
510
|
+
"""Enables auditing of how site collection is accessed, changed, and used."""
|
|
515
511
|
return self.properties.get(
|
|
516
512
|
"Audit", Audit(self.context, ResourcePath("Audit", self.resource_path))
|
|
517
513
|
)
|
|
518
514
|
|
|
519
515
|
@property
|
|
520
516
|
def can_upgrade(self):
|
|
517
|
+
# type: () -> Optional[bool]
|
|
521
518
|
"""
|
|
522
519
|
Specifies whether this site collection is in an implementation-specific valid state for site collection upgrade,
|
|
523
520
|
"true" if it is; otherwise, "false".
|
|
524
|
-
|
|
525
|
-
:rtype: bool
|
|
526
521
|
"""
|
|
527
522
|
return self.properties.get("CanUpgrade", None)
|
|
528
523
|
|
|
529
524
|
@property
|
|
530
525
|
def classification(self):
|
|
531
|
-
|
|
532
|
-
Gets the classification of this site.
|
|
533
|
-
|
|
534
|
-
:rtype: str or None
|
|
535
|
-
"""
|
|
526
|
+
# type: () -> Optional[str]
|
|
527
|
+
"""Gets the classification of this site."""
|
|
536
528
|
return self.properties.get("Classification", None)
|
|
537
529
|
|
|
538
530
|
@property
|
|
539
531
|
def compatibility_level(self):
|
|
532
|
+
# type: () -> Optional[str]
|
|
540
533
|
"""
|
|
541
534
|
Specifies the compatibility level of the site collection for the purpose of major version level compatibility
|
|
542
535
|
checks
|
|
543
|
-
|
|
544
|
-
:rtype: str
|
|
545
536
|
"""
|
|
546
537
|
return self.properties.get("CompatibilityLevel", None)
|
|
547
538
|
|
|
548
539
|
@property
|
|
549
540
|
def comments_on_site_pages_disabled(self):
|
|
550
|
-
|
|
551
|
-
Indicates whether comments on site pages are disabled or not.
|
|
552
|
-
:rtype: bool
|
|
553
|
-
"""
|
|
541
|
+
# type: () -> Optional[bool]
|
|
542
|
+
"""Indicates whether comments on site pages are disabled or not."""
|
|
554
543
|
return self.properties.get("CommentsOnSitePagesDisabled", None)
|
|
555
544
|
|
|
556
545
|
@property
|
|
@@ -560,17 +549,14 @@ class Site(Entity):
|
|
|
560
549
|
|
|
561
550
|
@property
|
|
562
551
|
def group_id(self):
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
"""
|
|
552
|
+
# type: () -> Optional[str]
|
|
553
|
+
"""Group identifier"""
|
|
566
554
|
return self.properties.get("GroupId", None)
|
|
567
555
|
|
|
568
556
|
@property
|
|
569
557
|
def lock_issue(self):
|
|
570
|
-
|
|
571
|
-
Specifies the comment that is used when a site collection is locked
|
|
572
|
-
:rtype: str or None
|
|
573
|
-
"""
|
|
558
|
+
# type: () -> Optional[str]
|
|
559
|
+
"""Specifies the comment that is used when a site collection is locked"""
|
|
574
560
|
return self.properties.get("LockIssue", None)
|
|
575
561
|
|
|
576
562
|
@property
|
|
@@ -583,6 +569,7 @@ class Site(Entity):
|
|
|
583
569
|
|
|
584
570
|
@property
|
|
585
571
|
def owner(self):
|
|
572
|
+
# type: () -> User
|
|
586
573
|
"""Gets or sets the owner of the site collection. (Read-only in sandboxed solutions.)"""
|
|
587
574
|
return self.properties.get(
|
|
588
575
|
"Owner", User(self.context, ResourcePath("Owner", self.resource_path))
|
|
@@ -590,54 +577,46 @@ class Site(Entity):
|
|
|
590
577
|
|
|
591
578
|
@property
|
|
592
579
|
def read_only(self):
|
|
580
|
+
# type: () -> Optional[bool]
|
|
593
581
|
"""
|
|
594
582
|
Gets a Boolean value that specifies whether the site collection is read-only,
|
|
595
583
|
locked, and unavailable for write access.
|
|
596
|
-
|
|
597
|
-
:rtype: bool
|
|
598
584
|
"""
|
|
599
585
|
return self.properties.get("ReadOnly", None)
|
|
600
586
|
|
|
601
587
|
@property
|
|
602
588
|
def required_designer_version(self):
|
|
589
|
+
# type: () -> Optional[str]
|
|
603
590
|
"""
|
|
604
591
|
Specifies the required minimum version of the designer that can be used on this site collection.
|
|
605
592
|
The default, if not disabled on the Web application, is "15.0.0.0".
|
|
606
|
-
|
|
607
|
-
:rtype: str
|
|
608
593
|
"""
|
|
609
594
|
return self.properties.get("RequiredDesignerVersion", None)
|
|
610
595
|
|
|
611
596
|
@property
|
|
612
597
|
def url(self):
|
|
613
598
|
# type: () -> Optional[str]
|
|
614
|
-
"""
|
|
615
|
-
Specifies the full URL of the site (2), including host name, port number and path
|
|
616
|
-
"""
|
|
599
|
+
"""Specifies the full URL of the site (2), including host name, port number and path"""
|
|
617
600
|
return self.properties.get("Url", None)
|
|
618
601
|
|
|
619
602
|
@property
|
|
620
603
|
def server_relative_url(self):
|
|
621
|
-
|
|
622
|
-
Specifies the server-relative URL of the top-level site in the site collection.
|
|
623
|
-
:rtype: str
|
|
624
|
-
"""
|
|
604
|
+
# type: () -> Optional[str]
|
|
605
|
+
"""Specifies the server-relative URL of the top-level site in the site collection."""
|
|
625
606
|
return self.properties.get("ServerRelativeUrl", None)
|
|
626
607
|
|
|
627
608
|
@property
|
|
628
609
|
def share_by_email_enabled(self):
|
|
610
|
+
# type: () -> Optional[bool]
|
|
629
611
|
"""
|
|
630
612
|
When true, users will be able to grant permissions to guests for resources within the site collection.
|
|
631
|
-
:rtype: bool or none
|
|
632
613
|
"""
|
|
633
614
|
return self.properties.get("ShareByEmailEnabled", None)
|
|
634
615
|
|
|
635
616
|
@property
|
|
636
617
|
def status_bar_text(self):
|
|
637
|
-
|
|
638
|
-
Gets or sets the status bar message text for this site.
|
|
639
|
-
:rtype: str or none
|
|
640
|
-
"""
|
|
618
|
+
# type: () -> Optional[str]
|
|
619
|
+
"""Gets or sets the status bar message text for this site."""
|
|
641
620
|
return self.properties.get("StatusBarText", None)
|
|
642
621
|
|
|
643
622
|
@property
|
|
@@ -711,6 +690,7 @@ class Site(Entity):
|
|
|
711
690
|
|
|
712
691
|
@property
|
|
713
692
|
def features(self):
|
|
693
|
+
# type: () -> FeatureCollection
|
|
714
694
|
"""Get features"""
|
|
715
695
|
return self.properties.get(
|
|
716
696
|
"Features",
|
|
@@ -731,9 +711,7 @@ class Site(Entity):
|
|
|
731
711
|
@property
|
|
732
712
|
def needs_b2b_upgrade(self):
|
|
733
713
|
# type: () -> Optional[bool]
|
|
734
|
-
"""
|
|
735
|
-
Specifies whether the site needs a Build-to-Build upgrade.
|
|
736
|
-
"""
|
|
714
|
+
"""Specifies whether the site needs a Build-to-Build upgrade."""
|
|
737
715
|
return self.properties.get("NeedsB2BUpgrade", None)
|
|
738
716
|
|
|
739
717
|
@property
|
|
@@ -28,9 +28,11 @@ class TaxonomyItem(ClientObject):
|
|
|
28
28
|
|
|
29
29
|
def set_property(self, name, value, persist_changes=True):
|
|
30
30
|
super(TaxonomyItem, self).set_property(name, value, persist_changes)
|
|
31
|
-
if self.
|
|
32
|
-
if
|
|
31
|
+
if name == self.property_ref_name:
|
|
32
|
+
if self._resource_path is None:
|
|
33
33
|
self._resource_path = ResourcePath(
|
|
34
34
|
value, self.parent_collection.resource_path
|
|
35
35
|
)
|
|
36
|
+
else:
|
|
37
|
+
self._resource_path.patch(value)
|
|
36
38
|
return self
|
|
@@ -57,16 +57,12 @@ class TermStore(TaxonomyItem):
|
|
|
57
57
|
@property
|
|
58
58
|
def default_language_tag(self):
|
|
59
59
|
# type: () -> Optional[str]
|
|
60
|
-
"""
|
|
61
|
-
Gets or sets the LCID of the default working language.
|
|
62
|
-
"""
|
|
60
|
+
"""Gets or sets the LCID of the default working language."""
|
|
63
61
|
return self.properties.get("defaultLanguageTag", None)
|
|
64
62
|
|
|
65
63
|
@property
|
|
66
64
|
def language_tags(self):
|
|
67
|
-
"""
|
|
68
|
-
Gets an integer collection of LCIDs.
|
|
69
|
-
"""
|
|
65
|
+
"""Gets an integer collection of LCIDs."""
|
|
70
66
|
return self.properties.get("languageTags", StringCollection())
|
|
71
67
|
|
|
72
68
|
@property
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
|
-
from office365.
|
|
3
|
+
from office365.onedrive.listitems.list_item import ListItem
|
|
4
4
|
from office365.runtime.paths.service_operation import ServiceOperationPath
|
|
5
|
+
from office365.runtime.paths.v3.entity import EntityPath
|
|
5
6
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
7
|
+
from office365.sharepoint.client_context import ClientContext
|
|
6
8
|
from office365.sharepoint.entity import Entity
|
|
7
|
-
from office365.sharepoint.
|
|
9
|
+
from office365.sharepoint.internal.paths.static_operation import StaticOperationPath
|
|
8
10
|
from office365.sharepoint.tenant.administration.deny_add_and_customize_pages_status import (
|
|
9
11
|
DenyAddAndCustomizePagesStatus,
|
|
10
12
|
)
|
|
13
|
+
from office365.sharepoint.tenant.administration.spo_operation import SpoOperation
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
class SiteProperties(Entity):
|
|
14
17
|
"""Contains a property bag of information about a site."""
|
|
15
18
|
|
|
19
|
+
def __repr__(self):
|
|
20
|
+
return self.url or self.entity_type_name
|
|
21
|
+
|
|
16
22
|
@staticmethod
|
|
17
23
|
def clear_sharing_lock_down(context, site_url):
|
|
18
|
-
|
|
19
|
-
:param office365.sharepoint.client_context.ClientContext context: SharePoint client service
|
|
20
|
-
:param str site_url:
|
|
21
|
-
"""
|
|
24
|
+
# type: (ClientContext, str) -> SiteProperties
|
|
22
25
|
payload = {"siteUrl": site_url}
|
|
23
26
|
binding_type = SiteProperties(context)
|
|
24
27
|
qry = ServiceOperationQuery(
|
|
@@ -30,75 +33,71 @@ class SiteProperties(Entity):
|
|
|
30
33
|
def update(self):
|
|
31
34
|
"""Updates the site collection properties with the new properties specified in the SiteProperties object."""
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
site.set_property("__siteUrl", self.url)
|
|
35
|
-
|
|
36
|
-
def _site_loaded(return_type):
|
|
37
|
-
self._resource_path = KeyPath(site.id, self.parent_collection.resource_path)
|
|
36
|
+
def _update():
|
|
38
37
|
super(SiteProperties, self).update()
|
|
39
38
|
|
|
40
|
-
self.
|
|
39
|
+
self._ensure_site_path(_update)
|
|
41
40
|
return self
|
|
42
41
|
|
|
42
|
+
def update_ex(self):
|
|
43
|
+
"""Updates the site collection properties with the new properties specified in the SiteProperties object."""
|
|
44
|
+
return_type = SpoOperation(self.context)
|
|
45
|
+
|
|
46
|
+
def _update_ex():
|
|
47
|
+
qry = ServiceOperationQuery(
|
|
48
|
+
self, "Update", parameters_type=self, return_type=return_type
|
|
49
|
+
)
|
|
50
|
+
self.context.add_query(qry)
|
|
51
|
+
|
|
52
|
+
self._ensure_site_path(_update_ex)
|
|
53
|
+
return return_type
|
|
54
|
+
|
|
43
55
|
@property
|
|
44
56
|
def deny_add_and_customize_pages(self):
|
|
45
|
-
|
|
46
|
-
Represents the status of the [DenyAddAndCustomizePages] feature on a site collection.
|
|
47
|
-
"""
|
|
57
|
+
# type: () -> Optional[int]
|
|
58
|
+
"""Represents the status of the [DenyAddAndCustomizePages] feature on a site collection."""
|
|
48
59
|
return self.properties.get(
|
|
49
60
|
"DenyAddAndCustomizePages", DenyAddAndCustomizePagesStatus.Unknown
|
|
50
61
|
)
|
|
51
62
|
|
|
52
63
|
@deny_add_and_customize_pages.setter
|
|
53
64
|
def deny_add_and_customize_pages(self, value):
|
|
54
|
-
|
|
55
|
-
Sets the status of the [DenyAddAndCustomizePages] feature on a site collection.
|
|
56
|
-
|
|
57
|
-
:param int value:
|
|
58
|
-
"""
|
|
65
|
+
# type: (int) -> None
|
|
66
|
+
"""Sets the status of the [DenyAddAndCustomizePages] feature on a site collection."""
|
|
59
67
|
self.set_property("DenyAddAndCustomizePages", value)
|
|
60
68
|
|
|
61
69
|
@property
|
|
62
70
|
def owner_login_name(self):
|
|
63
|
-
|
|
64
|
-
:rtype: str
|
|
65
|
-
"""
|
|
71
|
+
# type: () -> Optional[str]
|
|
66
72
|
return self.properties.get("OwnerLoginName", None)
|
|
67
73
|
|
|
68
74
|
@property
|
|
69
75
|
def webs_count(self):
|
|
70
|
-
|
|
71
|
-
Gets the number of Web objects in the site.
|
|
72
|
-
:rtype: int
|
|
73
|
-
"""
|
|
76
|
+
# type: () -> Optional[str]
|
|
77
|
+
"""Gets the number of Web objects in the site."""
|
|
74
78
|
return self.properties.get("WebsCount", None)
|
|
75
79
|
|
|
76
80
|
@property
|
|
77
81
|
def url(self):
|
|
78
82
|
# type: () -> Optional[str]
|
|
79
|
-
"""
|
|
80
|
-
Gets the URL of the site.
|
|
81
|
-
"""
|
|
83
|
+
"""Gets the URL of the site."""
|
|
82
84
|
return self.properties.get("Url", None)
|
|
83
85
|
|
|
84
86
|
@property
|
|
85
87
|
def compatibility_level(self):
|
|
86
88
|
# type: () -> Optional[str]
|
|
87
|
-
"""
|
|
88
|
-
Gets the compatibility level of the site.
|
|
89
|
-
"""
|
|
89
|
+
"""Gets the compatibility level of the site."""
|
|
90
90
|
return self.properties.get("CompatibilityLevel", None)
|
|
91
91
|
|
|
92
92
|
@property
|
|
93
93
|
def lock_state(self):
|
|
94
94
|
# type: () -> Optional[str]
|
|
95
|
-
"""
|
|
96
|
-
Gets or sets the lock state of the site.
|
|
97
|
-
"""
|
|
95
|
+
"""Gets or sets the lock state of the site."""
|
|
98
96
|
return self.properties.get("LockState", None)
|
|
99
97
|
|
|
100
98
|
@property
|
|
101
99
|
def sharing_capability(self):
|
|
100
|
+
# type: () -> Optional[int]
|
|
102
101
|
"""
|
|
103
102
|
Determines what level of sharing is available for the site.
|
|
104
103
|
|
|
@@ -115,29 +114,41 @@ class SiteProperties(Entity):
|
|
|
115
114
|
|
|
116
115
|
@sharing_capability.setter
|
|
117
116
|
def sharing_capability(self, value):
|
|
118
|
-
|
|
119
|
-
Sets the level of sharing for the site.
|
|
120
|
-
:type value: int
|
|
121
|
-
"""
|
|
117
|
+
# type: (int) -> None
|
|
118
|
+
"""Sets the level of sharing for the site."""
|
|
122
119
|
self.set_property("SharingCapability", value)
|
|
123
120
|
|
|
124
121
|
@property
|
|
125
122
|
def time_zone_id(self):
|
|
126
123
|
# type: () -> Optional[str]
|
|
127
|
-
"""
|
|
128
|
-
Gets the time zone ID of the site.
|
|
129
|
-
"""
|
|
124
|
+
"""Gets the time zone ID of the site."""
|
|
130
125
|
return self.properties.get("TimeZoneId", None)
|
|
131
126
|
|
|
132
127
|
@property
|
|
133
128
|
def entity_type_name(self):
|
|
129
|
+
# type: () -> str
|
|
134
130
|
return "Microsoft.Online.SharePoint.TenantAdministration.SiteProperties"
|
|
135
131
|
|
|
136
132
|
def set_property(self, name, value, persist_changes=True):
|
|
137
133
|
super(SiteProperties, self).set_property(name, value, persist_changes)
|
|
138
134
|
# fallback: create a new resource path
|
|
139
135
|
if name == "Url" and self._resource_path is None:
|
|
140
|
-
self._resource_path =
|
|
136
|
+
self._resource_path = StaticOperationPath(
|
|
141
137
|
self.entity_type_name, {"Url": value}
|
|
142
138
|
)
|
|
143
139
|
return self
|
|
140
|
+
|
|
141
|
+
def _ensure_site_path(self, action):
|
|
142
|
+
if isinstance(self.resource_path, ServiceOperationPath):
|
|
143
|
+
|
|
144
|
+
def _loaded(return_type):
|
|
145
|
+
# type: (ListItem) -> None
|
|
146
|
+
site_id = return_type.get_property("SiteId")
|
|
147
|
+
self._resource_path = EntityPath(
|
|
148
|
+
site_id, self.parent_collection.resource_path
|
|
149
|
+
)
|
|
150
|
+
action()
|
|
151
|
+
|
|
152
|
+
self.context.tenant.get_site(self.url).after_execute(_loaded)
|
|
153
|
+
else:
|
|
154
|
+
action()
|