Office365-REST-Python-Client 2.5.6__py3-none-any.whl → 2.5.8__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.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/METADATA +5 -5
- {Office365_REST_Python_Client-2.5.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/RECORD +147 -96
- office365/communications/onlinemeetings/online_meeting.py +30 -3
- office365/communications/onlinemeetings/recordings/__init__.py +0 -0
- office365/communications/onlinemeetings/recordings/call.py +5 -0
- office365/communications/onlinemeetings/transcripts/__init__.py +0 -0
- office365/directory/administrative_unit.py +9 -2
- office365/directory/applications/roles/collection.py +5 -1
- office365/directory/applications/roles/role.py +1 -1
- office365/directory/audit/provisioning/object_summary.py +30 -1
- office365/directory/authentication/methods/fido.py +8 -0
- office365/directory/authentication/methods/password.py +23 -0
- office365/directory/custom_security_attribute_definition.py +7 -0
- office365/directory/device_local_credential_info.py +6 -0
- office365/directory/directory.py +40 -12
- office365/directory/identitygovernance/appconsent/request_collection.py +1 -1
- office365/directory/identitygovernance/entitlementmanagement/entitlement_management.py +7 -0
- office365/directory/identitygovernance/governance.py +16 -0
- office365/directory/identitygovernance/termsofuse/agreement_acceptance.py +8 -0
- office365/directory/identitygovernance/userconsent/request_collection.py +1 -1
- office365/directory/insights/resource_reference.py +1 -1
- office365/directory/policies/device_registration.py +6 -0
- office365/directory/policies/root.py +13 -0
- office365/directory/security/threatintelligence/article_indicator.py +7 -0
- office365/directory/serviceprincipals/service_principal.py +109 -25
- office365/directory/synchronization/schema.py +16 -0
- office365/directory/users/user.py +23 -0
- office365/graph_client.py +8 -0
- office365/onedrive/driveitems/driveItem.py +86 -6
- office365/onedrive/driveitems/retention_label.py +25 -0
- office365/onedrive/lists/list.py +1 -1
- office365/onedrive/sitepages/__init__.py +0 -0
- office365/onedrive/sitepages/base.py +29 -0
- office365/onedrive/sitepages/canvas_layout.py +43 -0
- office365/onedrive/sitepages/collection.py +32 -0
- office365/onedrive/sitepages/horizontal_section.py +23 -0
- office365/onedrive/sitepages/horizontal_section_column.py +27 -0
- office365/onedrive/sitepages/site_page.py +116 -0
- office365/onedrive/sitepages/title_area.py +13 -0
- office365/onedrive/sitepages/vertical_section.py +27 -0
- office365/onedrive/sitepages/web_part.py +5 -0
- office365/onedrive/sites/site.py +10 -0
- office365/onedrive/workbooks/charts/chart.py +13 -0
- office365/onedrive/workbooks/charts/data_labels.py +13 -1
- office365/onedrive/workbooks/icon.py +5 -0
- office365/onedrive/workbooks/names/named_item.py +6 -0
- office365/onedrive/workbooks/ranges/font.py +5 -0
- office365/onedrive/workbooks/ranges/format.py +60 -0
- office365/onedrive/workbooks/ranges/range.py +12 -0
- office365/onedrive/workbooks/ranges/reference.py +6 -0
- office365/onedrive/workbooks/sort_field.py +26 -0
- office365/onedrive/workbooks/tables/pivot_table_collection.py +16 -0
- office365/onedrive/workbooks/tables/sort.py +5 -0
- office365/onedrive/workbooks/tables/table.py +57 -0
- office365/onedrive/workbooks/worksheets/protection.py +20 -1
- office365/onedrive/workbooks/worksheets/protection_options.py +10 -0
- office365/onedrive/workbooks/worksheets/worksheet.py +5 -4
- office365/outlook/calendar/calendar.py +1 -3
- office365/outlook/calendar/events/event.py +45 -0
- office365/outlook/calendar/response_status.py +11 -0
- office365/outlook/calendar/rooms/room.py +14 -0
- office365/outlook/mail/automatic_replies_mailtips.py +5 -0
- office365/outlook/mail/conversation.py +1 -3
- office365/outlook/mail/folders/folder.py +1 -3
- office365/outlook/mail/tips.py +17 -0
- office365/planner/plans/plan.py +11 -1
- office365/reports/root.py +33 -0
- office365/runtime/auth/authentication_context.py +12 -2
- office365/runtime/odata/json_format.py +3 -2
- office365/runtime/odata/request.py +12 -2
- office365/runtime/queries/upload_session.py +5 -0
- office365/sharepoint/activities/action_facet.py +17 -0
- office365/sharepoint/activities/client_request.py +4 -0
- office365/sharepoint/activities/client_response.py +8 -0
- office365/sharepoint/activities/entity.py +10 -0
- office365/sharepoint/activities/facets/delete.py +1 -0
- office365/sharepoint/activities/facets/get_mention.py +10 -0
- office365/sharepoint/activities/facets/in_doc.py +4 -0
- office365/sharepoint/activities/facets/move.py +14 -0
- office365/sharepoint/activities/facets/point_in_time_restore.py +9 -0
- office365/sharepoint/activities/facets/revision_set.py +9 -0
- office365/sharepoint/activities/facets/task_completed.py +9 -0
- office365/sharepoint/activities/facets/version.py +12 -0
- office365/sharepoint/activities/identity_item.py +16 -1
- office365/sharepoint/alerts/collection.py +2 -1
- office365/sharepoint/attachments/attachment.py +6 -9
- office365/sharepoint/attachments/collection.py +25 -3
- office365/sharepoint/client_context.py +33 -2
- office365/sharepoint/comments/collection.py +1 -1
- office365/sharepoint/compliance/store_proxy.py +43 -0
- office365/sharepoint/contenttypes/content_type.py +13 -1
- office365/sharepoint/contenttypes/fieldlinks/collection.py +1 -1
- office365/sharepoint/directory/helper.py +2 -0
- office365/sharepoint/directory/provider/alternate_id_data.py +9 -0
- office365/sharepoint/directory/provider/notification.py +15 -0
- office365/sharepoint/directory/provider/object_data.py +14 -0
- office365/sharepoint/directory/provider/provider.py +13 -0
- office365/sharepoint/entity.py +15 -0
- office365/sharepoint/features/collection.py +2 -0
- office365/sharepoint/fields/collection.py +4 -3
- office365/sharepoint/fields/user_value.py +1 -1
- office365/sharepoint/folders/folder.py +3 -5
- office365/sharepoint/migrationcenter/deploy_status.py +5 -0
- office365/sharepoint/migrationcenter/service/performance/__init__.py +0 -0
- office365/sharepoint/migrationcenter/service/performance/dashboard_data.py +9 -0
- office365/sharepoint/migrationcenter/service/performance/data.py +7 -0
- office365/sharepoint/migrationcenter/service/performance/entity_data.py +5 -0
- office365/sharepoint/multigeo/move_job_entity_data.py +9 -0
- office365/sharepoint/multigeo/site_move_job_entity_data.py +9 -0
- office365/sharepoint/multigeo/user_personal_site_location.py +9 -0
- office365/sharepoint/permissions/securable_object.py +2 -0
- office365/sharepoint/principal/principal.py +2 -4
- office365/sharepoint/recyclebin/item.py +107 -7
- office365/sharepoint/sharing/information.py +9 -0
- office365/sharepoint/sharing/link_info.py +6 -0
- office365/sharepoint/sharing/object_sharing_information.py +2 -0
- office365/sharepoint/sharing/permission_collection.py +18 -0
- office365/sharepoint/sharing/shared_document_info.py +9 -0
- office365/sharepoint/sites/script_safe_domain.py +5 -0
- office365/sharepoint/sites/site.py +10 -4
- office365/sharepoint/sites/version_policy_manager.py +7 -0
- office365/sharepoint/taxonomy/field_value.py +1 -1
- office365/sharepoint/tenant/administration/powerapps/__init__.py +0 -0
- office365/sharepoint/tenant/administration/powerapps/environment_context.py +8 -0
- office365/sharepoint/tenant/administration/secondary_administrators_info.py +5 -0
- office365/sharepoint/tenant/administration/tenant.py +14 -0
- office365/sharepoint/tenant/cdn_api.py +16 -0
- office365/sharepoint/tenant/management/externalusers/results/get.py +4 -0
- office365/sharepoint/tenant/management/office365_tenant.py +14 -0
- office365/sharepoint/ui/applicationpages/peoplepicker/web_service_interface.py +39 -33
- office365/sharepoint/userprofiles/cross_geo_sync.py +37 -0
- office365/sharepoint/userprofiles/cross_geo_sync_user_data_batch.py +5 -0
- office365/sharepoint/userprofiles/followed_content.py +15 -0
- office365/sharepoint/userprofiles/people_manager.py +23 -10
- office365/sharepoint/userprofiles/person_properties.py +7 -0
- office365/sharepoint/userprofiles/user_profile.py +4 -6
- office365/sharepoint/views/view.py +2 -0
- office365/sharepoint/webs/information_collection.py +1 -1
- office365/sharepoint/webs/regional_settings.py +71 -0
- office365/sharepoint/webs/web.py +53 -5
- office365/sharepoint/workflowservices/deployment_service.py +9 -0
- office365/teams/apps/catalog.py +1 -0
- office365/teams/chats/chat.py +4 -0
- office365/teams/schedule/schedule.py +6 -2
- {Office365_REST_Python_Client-2.5.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.6.dist-info → Office365_REST_Python_Client-2.5.8.dist-info}/top_level.txt +0 -0
office365/graph_client.py
CHANGED
|
@@ -25,6 +25,7 @@ from office365.directory.internal.paths.me import MePath
|
|
|
25
25
|
from office365.directory.invitations.collection import InvitationCollection
|
|
26
26
|
from office365.directory.licenses.subscribed_sku import SubscribedSku
|
|
27
27
|
from office365.directory.object_collection import DirectoryObjectCollection
|
|
28
|
+
from office365.directory.permissions.grants.oauth2 import OAuth2PermissionGrant
|
|
28
29
|
from office365.directory.permissions.grants.resource_specific import (
|
|
29
30
|
ResourceSpecificPermissionGrant,
|
|
30
31
|
)
|
|
@@ -516,6 +517,13 @@ class GraphClient(ClientRuntimeContext):
|
|
|
516
517
|
"""Gets all places in a tenant"""
|
|
517
518
|
return EntityCollection(self, Place, ResourcePath("places"))
|
|
518
519
|
|
|
520
|
+
@property
|
|
521
|
+
def oauth2_permission_grants(self):
|
|
522
|
+
"""Permission grants container"""
|
|
523
|
+
return DeltaCollection(
|
|
524
|
+
self, OAuth2PermissionGrant, ResourcePath("oauth2PermissionGrants")
|
|
525
|
+
)
|
|
526
|
+
|
|
519
527
|
@property
|
|
520
528
|
def room_lists(self):
|
|
521
529
|
"""Gets all the room lists in a tenant"""
|
|
@@ -2,6 +2,8 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
from datetime import datetime
|
|
5
|
+
from functools import partial
|
|
6
|
+
from os.path import isfile, join
|
|
5
7
|
from typing import IO, AnyStr, Callable, Optional, TypeVar
|
|
6
8
|
|
|
7
9
|
import requests
|
|
@@ -20,6 +22,7 @@ from office365.onedrive.driveitems.item_preview_info import ItemPreviewInfo
|
|
|
20
22
|
from office365.onedrive.driveitems.photo import Photo
|
|
21
23
|
from office365.onedrive.driveitems.publication_facet import PublicationFacet
|
|
22
24
|
from office365.onedrive.driveitems.remote_item import RemoteItem
|
|
25
|
+
from office365.onedrive.driveitems.retention_label import ItemRetentionLabel
|
|
23
26
|
from office365.onedrive.driveitems.special_folder import SpecialFolder
|
|
24
27
|
from office365.onedrive.driveitems.thumbnail_set import ThumbnailSet
|
|
25
28
|
from office365.onedrive.driveitems.uploadable_properties import (
|
|
@@ -272,6 +275,30 @@ class DriveItem(BaseItem):
|
|
|
272
275
|
name = os.path.basename(path_or_file)
|
|
273
276
|
return self.upload(name, content)
|
|
274
277
|
|
|
278
|
+
def upload_folder(self, path, file_uploaded=None):
|
|
279
|
+
# type: (str, Callable[["DriveItem"], None]) -> "DriveItem"
|
|
280
|
+
|
|
281
|
+
def _after_file_upload(return_type):
|
|
282
|
+
# type: ("DriveItem") -> None
|
|
283
|
+
if callable(file_uploaded):
|
|
284
|
+
file_uploaded(return_type)
|
|
285
|
+
|
|
286
|
+
def _upload_folder(source_path, target_folder):
|
|
287
|
+
# type: (str, "DriveItem") -> None
|
|
288
|
+
for name in os.listdir(source_path):
|
|
289
|
+
cur_path = join(source_path, name)
|
|
290
|
+
if isfile(cur_path):
|
|
291
|
+
with open(cur_path, "rb") as f:
|
|
292
|
+
target_folder.upload_file(f).after_execute(_after_file_upload)
|
|
293
|
+
else:
|
|
294
|
+
target_folder.create_folder(name).after_execute(
|
|
295
|
+
partial(_upload_folder, cur_path)
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
"""Uploads a folder"""
|
|
299
|
+
_upload_folder(path, self)
|
|
300
|
+
return self
|
|
301
|
+
|
|
275
302
|
def get_content(self, format_name=None):
|
|
276
303
|
# type: (Optional[str]) -> ClientResult[AnyStr]
|
|
277
304
|
"""
|
|
@@ -302,6 +329,52 @@ class DriveItem(BaseItem):
|
|
|
302
329
|
self.get_content().after_execute(_save_content)
|
|
303
330
|
return self
|
|
304
331
|
|
|
332
|
+
def download_folder(
|
|
333
|
+
self, download_file, after_file_downloaded=None, recursive=True
|
|
334
|
+
):
|
|
335
|
+
# type: (IO, Callable[[File], None], bool) -> "DriveItem"
|
|
336
|
+
"""
|
|
337
|
+
Download the folder content
|
|
338
|
+
"""
|
|
339
|
+
import zipfile
|
|
340
|
+
|
|
341
|
+
def _after_file_downloaded(drive_item, base_path, result):
|
|
342
|
+
# type: ("DriveItem", str, ClientResult[AnyStr]) -> None
|
|
343
|
+
with zipfile.ZipFile(download_file.name, "a", zipfile.ZIP_DEFLATED) as zf:
|
|
344
|
+
zip_path = (
|
|
345
|
+
"/".join([base_path, drive_item.name])
|
|
346
|
+
if base_path is not None
|
|
347
|
+
else drive_item.name
|
|
348
|
+
)
|
|
349
|
+
zf.writestr(zip_path, result.value)
|
|
350
|
+
if callable(after_file_downloaded):
|
|
351
|
+
after_file_downloaded(drive_item)
|
|
352
|
+
|
|
353
|
+
def _after_folder_downloaded(parent_item, base_path=None):
|
|
354
|
+
# type: ("DriveItem", str) -> None
|
|
355
|
+
for drive_item in parent_item.children:
|
|
356
|
+
if drive_item.is_file:
|
|
357
|
+
drive_item.get_content().after_execute(
|
|
358
|
+
partial(_after_file_downloaded, drive_item, base_path)
|
|
359
|
+
)
|
|
360
|
+
else:
|
|
361
|
+
if recursive:
|
|
362
|
+
if base_path is None:
|
|
363
|
+
next_base_path = str(drive_item.name)
|
|
364
|
+
else:
|
|
365
|
+
next_base_path = "/".join([base_path, drive_item.name])
|
|
366
|
+
_download_folder(drive_item, next_base_path)
|
|
367
|
+
|
|
368
|
+
def _download_folder(drive_item, prev_result=None):
|
|
369
|
+
# type: ("DriveItem", str) -> None
|
|
370
|
+
drive_item.ensure_properties(
|
|
371
|
+
["children", "name"],
|
|
372
|
+
partial(_after_folder_downloaded, drive_item, prev_result),
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
_download_folder(self)
|
|
376
|
+
return self
|
|
377
|
+
|
|
305
378
|
def download_session(
|
|
306
379
|
self, file_object, chunk_downloaded=None, chunk_size=1024 * 1024
|
|
307
380
|
):
|
|
@@ -600,9 +673,7 @@ class DriveItem(BaseItem):
|
|
|
600
673
|
@property
|
|
601
674
|
def audio(self):
|
|
602
675
|
# type: () -> Audio
|
|
603
|
-
"""
|
|
604
|
-
Audio metadata, if the item is an audio file. Read-only.
|
|
605
|
-
"""
|
|
676
|
+
"""Audio metadata, if the item is an audio file. Read-only."""
|
|
606
677
|
return self.properties.get("audio", Audio())
|
|
607
678
|
|
|
608
679
|
@property
|
|
@@ -616,9 +687,7 @@ class DriveItem(BaseItem):
|
|
|
616
687
|
@property
|
|
617
688
|
def photo(self):
|
|
618
689
|
# type: () -> Photo
|
|
619
|
-
"""
|
|
620
|
-
Photo metadata, if the item is a photo. Read-only.
|
|
621
|
-
"""
|
|
690
|
+
"""Photo metadata, if the item is a photo. Read-only."""
|
|
622
691
|
return self.properties.get("photo", Photo())
|
|
623
692
|
|
|
624
693
|
@property
|
|
@@ -717,6 +786,17 @@ class DriveItem(BaseItem):
|
|
|
717
786
|
),
|
|
718
787
|
)
|
|
719
788
|
|
|
789
|
+
@property
|
|
790
|
+
def retention_label(self):
|
|
791
|
+
# type: () -> ItemRetentionLabel
|
|
792
|
+
"""Information about retention label and settings enforced on the driveItem."""
|
|
793
|
+
return self.properties.get(
|
|
794
|
+
"retentionLabel",
|
|
795
|
+
ItemRetentionLabel(
|
|
796
|
+
self.context, ResourcePath("retentionLabel", self.resource_path)
|
|
797
|
+
),
|
|
798
|
+
)
|
|
799
|
+
|
|
720
800
|
@property
|
|
721
801
|
def publication(self):
|
|
722
802
|
# type: () -> PublicationFacet
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from office365.directory.permissions.identity_set import IdentitySet
|
|
4
|
+
from office365.entity import Entity
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ItemRetentionLabel(Entity):
|
|
8
|
+
"""
|
|
9
|
+
Groups retention and compliance-related properties on an item into a single structure.
|
|
10
|
+
Currently, supported only for driveItem.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def is_label_applied_explicitly(self):
|
|
15
|
+
# type: () -> Optional[bool]
|
|
16
|
+
"""Specifies whether the label is applied explicitly on the item.
|
|
17
|
+
True indicates that the label is applied explicitly; otherwise, the label is inherited from its parent.
|
|
18
|
+
Read-only."""
|
|
19
|
+
return self.properties.get("isLabelAppliedExplicitly", None)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def label_applied_by(self):
|
|
23
|
+
# type: () -> Optional[IdentitySet]
|
|
24
|
+
"""Identity of the user who applied the label. Read-only."""
|
|
25
|
+
return self.properties.get("labelAppliedBy", IdentitySet())
|
office365/onedrive/lists/list.py
CHANGED
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from office365.base_item import BaseItem
|
|
4
|
+
from office365.onedrive.driveitems.publication_facet import PublicationFacet
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class BaseSitePage(BaseItem):
|
|
8
|
+
"""An abstract type that represents a page in the site page library."""
|
|
9
|
+
|
|
10
|
+
@property
|
|
11
|
+
def publishing_state(self):
|
|
12
|
+
# type: () -> Optional[str]
|
|
13
|
+
"""The publishing status and the MM.mm version of the page."""
|
|
14
|
+
return self.properties.get("publishingState", PublicationFacet())
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def page_layout(self):
|
|
18
|
+
# type: () -> Optional[str]
|
|
19
|
+
"""
|
|
20
|
+
The name of the page layout of the page.
|
|
21
|
+
The possible values are: microsoftReserved, article, home, unknownFutureValue.
|
|
22
|
+
"""
|
|
23
|
+
return self.properties.get("pageLayout", None)
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def title(self):
|
|
27
|
+
# type: () -> Optional[str]
|
|
28
|
+
"""Title of the sitePage."""
|
|
29
|
+
return self.properties.get("title", None)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
from office365.entity_collection import EntityCollection
|
|
3
|
+
from office365.onedrive.sitepages.horizontal_section import HorizontalSection
|
|
4
|
+
from office365.onedrive.sitepages.vertical_section import VerticalSection
|
|
5
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CanvasLayout(Entity):
|
|
9
|
+
"""Represents the layout of the content in a given SharePoint page."""
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
def horizontal_sections(self):
|
|
13
|
+
# type: () -> EntityCollection[HorizontalSection]
|
|
14
|
+
"""Collection of horizontal sections on the SharePoint page.."""
|
|
15
|
+
return self.properties.get(
|
|
16
|
+
"horizontalSections",
|
|
17
|
+
EntityCollection(
|
|
18
|
+
self.context,
|
|
19
|
+
HorizontalSection,
|
|
20
|
+
ResourcePath("horizontalSections", self.resource_path),
|
|
21
|
+
),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def vertical_section(self):
|
|
26
|
+
# type: () -> VerticalSection
|
|
27
|
+
"""Vertical section on the SharePoint page."""
|
|
28
|
+
return self.properties.get(
|
|
29
|
+
"verticalSection",
|
|
30
|
+
VerticalSection(
|
|
31
|
+
self.context,
|
|
32
|
+
ResourcePath("verticalSection", self.resource_path),
|
|
33
|
+
),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def get_property(self, name, default_value=None):
|
|
37
|
+
if default_value is None:
|
|
38
|
+
property_mapping = {
|
|
39
|
+
"horizontalSections": self.horizontal_sections,
|
|
40
|
+
"verticalSection": self.vertical_section,
|
|
41
|
+
}
|
|
42
|
+
default_value = property_mapping.get(name, None)
|
|
43
|
+
return super(CanvasLayout, self).get_property(name, default_value)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from office365.entity_collection import EntityCollection
|
|
2
|
+
from office365.onedrive.sitepages.site_page import SitePage
|
|
3
|
+
from office365.onedrive.sitepages.title_area import TitleArea
|
|
4
|
+
from office365.runtime.http.request_options import RequestOptions
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SitePageCollection(EntityCollection[SitePage]):
|
|
8
|
+
"""Sites container"""
|
|
9
|
+
|
|
10
|
+
def __init__(self, context, resource_path=None):
|
|
11
|
+
super(SitePageCollection, self).__init__(context, SitePage, resource_path)
|
|
12
|
+
|
|
13
|
+
def add(self, title):
|
|
14
|
+
"""
|
|
15
|
+
Create a new sitePage in the site pages list in a site.
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def _construct_request(request):
|
|
20
|
+
# type: (RequestOptions) -> None
|
|
21
|
+
request.set_header("Content-Type", "application/json")
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
super(SitePageCollection, self)
|
|
25
|
+
.add(
|
|
26
|
+
title=title,
|
|
27
|
+
name="{0}.aspx".format(title),
|
|
28
|
+
pageLayout="article",
|
|
29
|
+
titleArea=TitleArea(),
|
|
30
|
+
)
|
|
31
|
+
.before_execute(_construct_request)
|
|
32
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
from office365.entity_collection import EntityCollection
|
|
3
|
+
from office365.onedrive.sitepages.horizontal_section_column import (
|
|
4
|
+
HorizontalSectionColumn,
|
|
5
|
+
)
|
|
6
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HorizontalSection(Entity):
|
|
10
|
+
"""Represents a horizontal section in a given SharePoint page."""
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def columns(self):
|
|
14
|
+
# type: () -> EntityCollection[HorizontalSectionColumn]
|
|
15
|
+
"""The set of vertical columns in this section."""
|
|
16
|
+
return self.properties.get(
|
|
17
|
+
"columns",
|
|
18
|
+
EntityCollection(
|
|
19
|
+
self.context,
|
|
20
|
+
HorizontalSectionColumn,
|
|
21
|
+
ResourcePath("columns", self.resource_path),
|
|
22
|
+
),
|
|
23
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
from office365.entity_collection import EntityCollection
|
|
3
|
+
from office365.onedrive.sitepages.web_part import WebPart
|
|
4
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class HorizontalSectionColumn(Entity):
|
|
8
|
+
"""Represents a vertical column in a given horizontal section."""
|
|
9
|
+
|
|
10
|
+
@property
|
|
11
|
+
def web_parts(self):
|
|
12
|
+
# type: () -> EntityCollection[WebPart]
|
|
13
|
+
"""The set of web parts in this section."""
|
|
14
|
+
return self.properties.get(
|
|
15
|
+
"webParts",
|
|
16
|
+
EntityCollection(
|
|
17
|
+
self.context, WebPart, ResourcePath("webParts", self.resource_path)
|
|
18
|
+
),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def get_property(self, name, default_value=None):
|
|
22
|
+
if default_value is None:
|
|
23
|
+
property_mapping = {
|
|
24
|
+
"webParts": self.web_parts,
|
|
25
|
+
}
|
|
26
|
+
default_value = property_mapping.get(name, None)
|
|
27
|
+
return super(HorizontalSectionColumn, self).get_property(name, default_value)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from office365.entity_collection import EntityCollection
|
|
4
|
+
from office365.onedrive.sitepages.base import BaseSitePage
|
|
5
|
+
from office365.onedrive.sitepages.canvas_layout import CanvasLayout
|
|
6
|
+
from office365.onedrive.sitepages.title_area import TitleArea
|
|
7
|
+
from office365.onedrive.sitepages.web_part import WebPart
|
|
8
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
9
|
+
from office365.runtime.queries.function import FunctionQuery
|
|
10
|
+
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SitePage(BaseSitePage):
|
|
14
|
+
"""This resource represents a page in the sitePages list. It contains the title, layout, and a collection of
|
|
15
|
+
webParts."""
|
|
16
|
+
|
|
17
|
+
def get_web_parts_by_position(
|
|
18
|
+
self, webPartIndex, horizontalSectionId, isInVerticalSection, columnId
|
|
19
|
+
):
|
|
20
|
+
"""
|
|
21
|
+
Get a collection of webPart by providing webPartPosition information.
|
|
22
|
+
|
|
23
|
+
:param float webPartIndex: Index of the current WebPart. Represents the order of WebPart in this column or
|
|
24
|
+
section. Only works if either columnId or isInVerticalSection is provided.
|
|
25
|
+
:param float horizontalSectionId: Indicate the horizontal section where the WebPart located in.
|
|
26
|
+
:param bool isInVerticalSection: Indicate whether the WebPart located in the vertical section.
|
|
27
|
+
:param float columnId: Indicate the identifier of the column where the WebPart located in. Only works
|
|
28
|
+
if horizontalSectionId is provided.
|
|
29
|
+
"""
|
|
30
|
+
params = {
|
|
31
|
+
"webPartIndex": webPartIndex,
|
|
32
|
+
"horizontalSectionId": horizontalSectionId,
|
|
33
|
+
"isInverticalSection": isInVerticalSection,
|
|
34
|
+
"columnId": columnId,
|
|
35
|
+
}
|
|
36
|
+
return_type = EntityCollection(
|
|
37
|
+
self.context, WebPart, ResourcePath("webParts", self.resource_path)
|
|
38
|
+
)
|
|
39
|
+
qry = FunctionQuery(self, "getWebPartsByPosition", params, return_type)
|
|
40
|
+
self.context.add_query(qry)
|
|
41
|
+
return return_type
|
|
42
|
+
|
|
43
|
+
def publish(self):
|
|
44
|
+
"""
|
|
45
|
+
Publish the latest version of a sitePage resource, which makes the version of the page available to all users.
|
|
46
|
+
If the page is checked out, check in the page and publish it. If the page is checked out to the caller
|
|
47
|
+
of this API, the page is automatically checked in and then published.
|
|
48
|
+
|
|
49
|
+
If a page approval flow has been activated in the page library, the page is not published until the approval
|
|
50
|
+
flow is completed.
|
|
51
|
+
"""
|
|
52
|
+
qry = ServiceOperationQuery(self, "publish")
|
|
53
|
+
self.context.add_query(qry)
|
|
54
|
+
return self
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def promotion_kind(self):
|
|
58
|
+
# type: () -> Optional[str]
|
|
59
|
+
"""Indicates the promotion kind of the sitePage."""
|
|
60
|
+
return self.properties.get("promotionKind", None)
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def show_comments(self):
|
|
64
|
+
# type: () -> Optional[bool]
|
|
65
|
+
"""Determines whether or not to show comments at the bottom of the page."""
|
|
66
|
+
return self.properties.get("showComments", None)
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def show_recommended_pages(self):
|
|
70
|
+
# type: () -> Optional[bool]
|
|
71
|
+
"""Determines whether or not to show recommended pages at the bottom of the page."""
|
|
72
|
+
return self.properties.get("showRecommendedPages", None)
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def thumbnail_web_url(self):
|
|
76
|
+
# type: () -> Optional[str]
|
|
77
|
+
"""Indicates the promotion kind of the sitePage."""
|
|
78
|
+
return self.properties.get("thumbnailWebUrl", None)
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def title_area(self):
|
|
82
|
+
# type: () -> Optional[str]
|
|
83
|
+
"""Title area on the SharePoint page."""
|
|
84
|
+
return self.properties.get("titleArea", TitleArea())
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def canvas_layout(self):
|
|
88
|
+
# type: () -> CanvasLayout
|
|
89
|
+
"""The default termStore under this site."""
|
|
90
|
+
return self.properties.get(
|
|
91
|
+
"canvasLayout",
|
|
92
|
+
CanvasLayout(
|
|
93
|
+
self.context, ResourcePath("canvasLayout", self.resource_path)
|
|
94
|
+
),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def web_parts(self):
|
|
99
|
+
# type: () -> EntityCollection[WebPart]
|
|
100
|
+
"""Collection of webparts on the SharePoint page."""
|
|
101
|
+
return self.properties.get(
|
|
102
|
+
"webParts",
|
|
103
|
+
EntityCollection(
|
|
104
|
+
self.context, WebPart, ResourcePath("webParts", self.resource_path)
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
def get_property(self, name, default_value=None):
|
|
109
|
+
if default_value is None:
|
|
110
|
+
property_mapping = {
|
|
111
|
+
"canvasLayout": self.canvas_layout,
|
|
112
|
+
"titleArea": self.title_area,
|
|
113
|
+
"webParts": self.web_parts,
|
|
114
|
+
}
|
|
115
|
+
default_value = property_mapping.get(name, None)
|
|
116
|
+
return super(SitePage, self).get_property(name, default_value)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from office365.runtime.client_value import ClientValue
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TitleArea(ClientValue):
|
|
5
|
+
"""Represents the title area of a given SharePoint page."""
|
|
6
|
+
|
|
7
|
+
def __init__(self, alternativeText=None, enableGradientEffect=None):
|
|
8
|
+
"""
|
|
9
|
+
:param str alternativeText: Alternative text on the title area.
|
|
10
|
+
:param bool enableGradientEffect: Indicates whether the title area has a gradient effect enabled.
|
|
11
|
+
"""
|
|
12
|
+
self.alternativeText = alternativeText
|
|
13
|
+
self.enableGradientEffect = enableGradientEffect
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
from office365.entity_collection import EntityCollection
|
|
3
|
+
from office365.onedrive.sitepages.web_part import WebPart
|
|
4
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class VerticalSection(Entity):
|
|
8
|
+
"""Represents the vertical section in a given SharePoint page."""
|
|
9
|
+
|
|
10
|
+
@property
|
|
11
|
+
def web_parts(self):
|
|
12
|
+
# type: () -> EntityCollection[WebPart]
|
|
13
|
+
"""The set of web parts in this section."""
|
|
14
|
+
return self.properties.get(
|
|
15
|
+
"webParts",
|
|
16
|
+
EntityCollection(
|
|
17
|
+
self.context, WebPart, ResourcePath("webParts", self.resource_path)
|
|
18
|
+
),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def get_property(self, name, default_value=None):
|
|
22
|
+
if default_value is None:
|
|
23
|
+
property_mapping = {
|
|
24
|
+
"webParts": self.web_parts,
|
|
25
|
+
}
|
|
26
|
+
default_value = property_mapping.get(name, None)
|
|
27
|
+
return super(VerticalSection, self).get_property(name, default_value)
|
office365/onedrive/sites/site.py
CHANGED
|
@@ -13,6 +13,7 @@ from office365.onedrive.lists.collection import ListCollection
|
|
|
13
13
|
from office365.onedrive.operations.rich_long_running import RichLongRunningOperation
|
|
14
14
|
from office365.onedrive.permissions.collection import PermissionCollection
|
|
15
15
|
from office365.onedrive.sharepoint_ids import SharePointIds
|
|
16
|
+
from office365.onedrive.sitepages.collection import SitePageCollection
|
|
16
17
|
from office365.onedrive.sites.site_collection import SiteCollection
|
|
17
18
|
from office365.onedrive.termstore.store import Store
|
|
18
19
|
from office365.onenote.onenote import Onenote
|
|
@@ -224,6 +225,15 @@ class Site(BaseItem):
|
|
|
224
225
|
Onenote(self.context, ResourcePath("onenote", self.resource_path)),
|
|
225
226
|
)
|
|
226
227
|
|
|
228
|
+
@property
|
|
229
|
+
def pages(self):
|
|
230
|
+
# type: () -> SitePageCollection
|
|
231
|
+
"""The collection of site pages under this site."""
|
|
232
|
+
return self.properties.get(
|
|
233
|
+
"pages",
|
|
234
|
+
SitePageCollection(self.context, ResourcePath("pages", self.resource_path)),
|
|
235
|
+
)
|
|
236
|
+
|
|
227
237
|
@property
|
|
228
238
|
def term_store(self):
|
|
229
239
|
# type: () -> Store
|
|
@@ -2,11 +2,24 @@ from office365.entity import Entity
|
|
|
2
2
|
from office365.onedrive.workbooks.charts.axes import WorkbookChartAxes
|
|
3
3
|
from office365.onedrive.workbooks.charts.data_labels import WorkbookChartDataLabels
|
|
4
4
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
5
|
+
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class WorkbookChart(Entity):
|
|
8
9
|
"""Represents a chart object in a workbook."""
|
|
9
10
|
|
|
11
|
+
def set_position(self, startCell, endCell):
|
|
12
|
+
"""Positions the chart relative to cells on the worksheet.
|
|
13
|
+
:param str startCell: The start cell. It is where the chart is moved to. The start cell is the top-left or
|
|
14
|
+
top-right cell, depending on the user's right-to-left display settings.
|
|
15
|
+
:param str endCell: The end cell. If specified, the chart's width and height is set to fully cover up
|
|
16
|
+
this cell/range.
|
|
17
|
+
"""
|
|
18
|
+
payload = {"startCell": startCell, "endCell": endCell}
|
|
19
|
+
qry = ServiceOperationQuery(self, "setPosition", None, payload)
|
|
20
|
+
self.context.add_query(qry)
|
|
21
|
+
return self
|
|
22
|
+
|
|
10
23
|
@property
|
|
11
24
|
def axes(self):
|
|
12
25
|
"""Represents chart axes."""
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.entity import Entity
|
|
2
4
|
|
|
3
5
|
|
|
4
6
|
class WorkbookChartDataLabels(Entity):
|
|
5
7
|
"""Represents a collection of all the data labels on a chart point."""
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
@property
|
|
10
|
+
def position(self):
|
|
11
|
+
# type: () -> Optional[str]
|
|
12
|
+
"""DataLabelPosition value that represents the position of the data label."""
|
|
13
|
+
return self.properties.get("position", None)
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def separator(self):
|
|
17
|
+
# type: () -> Optional[str]
|
|
18
|
+
"""String representing the separator used for the data labels on a chart."""
|
|
19
|
+
return self.properties.get("separator", None)
|
|
@@ -33,6 +33,12 @@ class WorkbookNamedItem(Entity):
|
|
|
33
33
|
"""Represents the comment associated with this name."""
|
|
34
34
|
return self.properties.get("comment", None)
|
|
35
35
|
|
|
36
|
+
@property
|
|
37
|
+
def scope(self):
|
|
38
|
+
# type: () -> Optional[str]
|
|
39
|
+
"""Indicates whether the name is scoped to the workbook or to a specific worksheet."""
|
|
40
|
+
return self.properties.get("scope", None)
|
|
41
|
+
|
|
36
42
|
@property
|
|
37
43
|
def worksheet(self):
|
|
38
44
|
"""Returns the worksheet on which the named item is scoped to. Available only if the item is scoped
|