Office365-REST-Python-Client 2.5.1__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.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/METADATA +6 -6
- {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/RECORD +265 -259
- office365/base_item.py +12 -20
- office365/communications/onlinemeetings/collection.py +1 -1
- office365/communications/onlinemeetings/online_meeting.py +20 -35
- office365/communications/presences/presence.py +18 -7
- office365/delta_collection.py +10 -1
- office365/delta_path.py +1 -1
- office365/directory/administrative_unit.py +6 -7
- office365/directory/applications/application.py +24 -18
- office365/directory/applications/roles/assignment.py +13 -1
- office365/directory/applications/roles/collection.py +13 -0
- office365/directory/applications/roles/role.py +6 -1
- office365/directory/audit/directory.py +8 -7
- office365/directory/audit/log_root.py +3 -0
- office365/directory/audit/signins/signin.py +19 -29
- office365/directory/authentication/authentication.py +1 -0
- office365/directory/authentication/methods/details.py +8 -6
- office365/directory/authentication/methods/phone.py +3 -1
- office365/directory/extensions/extension_property.py +7 -9
- office365/directory/groups/collection.py +10 -3
- office365/directory/groups/group.py +19 -19
- office365/directory/groups/lifecycle_policy.py +8 -7
- office365/directory/identities/provider.py +5 -6
- office365/directory/insights/usage_details.py +8 -3
- office365/directory/internal/paths/me.py +1 -1
- office365/directory/invitations/collection.py +1 -1
- office365/directory/invitations/invitation.py +6 -6
- office365/directory/object_collection.py +2 -3
- office365/directory/permissions/email_identity.py +7 -0
- office365/directory/permissions/grants/resource_specific.py +10 -9
- office365/directory/permissions/identity.py +3 -0
- office365/directory/permissions/identity_set.py +3 -0
- office365/directory/policies/base.py +4 -4
- office365/directory/policies/root.py +6 -4
- office365/directory/protection/information.py +3 -3
- office365/directory/rolemanagement/application.py +2 -0
- office365/directory/rolemanagement/role.py +11 -10
- office365/directory/rolemanagement/template.py +9 -8
- office365/directory/rolemanagement/unified_role_assignment.py +5 -4
- office365/directory/rolemanagement/unified_role_definition.py +6 -4
- office365/directory/security/security.py +3 -0
- office365/directory/serviceprincipals/collection.py +20 -4
- office365/directory/serviceprincipals/service_principal.py +79 -12
- office365/directory/users/activities/activity.py +5 -4
- office365/directory/users/user.py +29 -34
- office365/entity.py +2 -2
- office365/entity_collection.py +12 -5
- office365/graph_client.py +90 -8
- office365/intune/audit/event.py +4 -3
- 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/column_link.py +4 -4
- office365/onedrive/columns/definition.py +29 -32
- office365/onedrive/columns/definition_collection.py +1 -1
- office365/onedrive/contenttypes/content_type.py +16 -18
- office365/onedrive/documentsets/version.py +7 -3
- office365/onedrive/driveitems/driveItem.py +48 -49
- office365/onedrive/drives/drive.py +7 -2
- 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 +28 -7
- office365/onedrive/permissions/permission.py +5 -7
- office365/onedrive/permissions/sharing_link.py +1 -1
- office365/onedrive/sharepoint.py +1 -0
- office365/onedrive/shares/collection.py +2 -5
- office365/onedrive/shares/drive_item.py +4 -0
- office365/onedrive/sites/site.py +6 -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/rows/row.py +3 -0
- office365/onedrive/workbooks/tables/table.py +7 -4
- office365/onedrive/workbooks/worksheets/worksheet.py +12 -4
- office365/onenote/entity_hierarchy_model.py +4 -0
- office365/onenote/internal/multipart_page_query.py +4 -5
- office365/onenote/notebooks/notebook.py +4 -0
- office365/onenote/pages/collection.py +3 -2
- office365/onenote/resources/resource.py +5 -4
- office365/onenote/sectiongroups/section_group.py +10 -7
- office365/onenote/sections/section.py +1 -1
- office365/outlook/calendar/attendees/base.py +2 -1
- office365/outlook/calendar/calendar.py +18 -10
- office365/outlook/calendar/events/collection.py +0 -2
- office365/outlook/calendar/group.py +7 -8
- office365/outlook/calendar/meetingtimes/suggestion.py +8 -4
- office365/outlook/calendar/meetingtimes/time_slot.py +3 -0
- office365/outlook/calendar/permissions/collection.py +1 -1
- office365/outlook/calendar/rooms/__init__.py +0 -0
- office365/outlook/calendar/rooms/list.py +27 -0
- office365/outlook/calendar/rooms/room.py +8 -0
- office365/outlook/calendar/schedule/information.py +0 -1
- office365/outlook/contacts/collection.py +0 -8
- office365/outlook/contacts/contact.py +14 -14
- office365/outlook/contacts/folder.py +3 -0
- office365/outlook/mail/attachments/attachment.py +31 -31
- office365/outlook/mail/attachments/collection.py +34 -6
- office365/outlook/mail/conversation.py +6 -4
- office365/outlook/mail/folders/collection.py +0 -7
- office365/outlook/mail/folders/folder.py +50 -18
- office365/outlook/mail/messages/collection.py +0 -1
- office365/outlook/mail/messages/message.py +58 -68
- office365/outlook/mail/physical_address.py +11 -5
- office365/outlook/mail/recipient.py +3 -1
- office365/outlook/mail/recurrence_range.py +14 -6
- office365/outlook/user.py +1 -0
- office365/planner/planner.py +9 -12
- office365/planner/plans/collection.py +17 -18
- office365/planner/plans/container.py +11 -0
- office365/planner/plans/plan.py +21 -10
- office365/runtime/auth/authentication_context.py +3 -3
- office365/runtime/auth/providers/acs_token_provider.py +7 -9
- office365/runtime/auth/providers/saml_token_provider.py +5 -2
- office365/runtime/client_object.py +6 -15
- office365/runtime/client_object_collection.py +36 -35
- office365/runtime/client_result.py +6 -7
- office365/runtime/client_runtime_context.py +10 -16
- office365/runtime/client_value_collection.py +3 -10
- office365/runtime/compat.py +2 -0
- office365/runtime/odata/query_options.py +1 -3
- office365/runtime/odata/reader.py +1 -1
- office365/runtime/odata/request.py +2 -4
- office365/runtime/odata/type.py +17 -0
- office365/runtime/odata/v4/upload_session_request.py +27 -30
- office365/runtime/paths/appid.py +1 -1
- office365/runtime/{odata/url_builder.py → paths/builder.py} +24 -9
- office365/runtime/paths/item.py +3 -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/runtime/queries/function.py +1 -1
- office365/runtime/types/event_handler.py +1 -3
- office365/search/entity.py +15 -8
- office365/search/external/external.py +1 -0
- office365/search/sort_property.py +3 -0
- office365/sharepoint/attachments/attachment.py +3 -1
- office365/sharepoint/attachments/collection.py +3 -0
- office365/sharepoint/changes/change.py +12 -1
- office365/sharepoint/changes/collection.py +1 -1
- office365/sharepoint/changes/list.py +3 -0
- office365/sharepoint/changes/token.py +4 -0
- office365/sharepoint/changes/type.py +23 -23
- office365/sharepoint/changes/web.py +7 -3
- office365/sharepoint/client_context.py +21 -18
- office365/sharepoint/clientsidecomponent/hostedapps/manager.py +3 -3
- office365/sharepoint/contenttypes/content_type.py +47 -56
- office365/sharepoint/contenttypes/content_type_id.py +1 -1
- office365/sharepoint/documentmanagement/document_id.py +2 -2
- office365/sharepoint/documentmanagement/document_set.py +6 -7
- office365/sharepoint/entity_collection.py +9 -0
- office365/sharepoint/features/feature.py +6 -8
- office365/sharepoint/fields/collection.py +6 -5
- office365/sharepoint/fields/field.py +28 -46
- office365/sharepoint/fields/related_field_collection.py +1 -1
- office365/sharepoint/fields/user_value.py +3 -3
- office365/sharepoint/files/checked_out_file.py +4 -2
- office365/sharepoint/files/checked_out_file_collection.py +1 -1
- office365/sharepoint/files/collection.py +84 -14
- office365/sharepoint/files/file.py +118 -110
- office365/sharepoint/files/versions/collection.py +5 -3
- office365/sharepoint/files/versions/event.py +6 -3
- office365/sharepoint/files/versions/version.py +31 -18
- office365/sharepoint/folders/collection.py +5 -10
- office365/sharepoint/folders/folder.py +41 -24
- office365/sharepoint/forms/collection.py +1 -1
- office365/sharepoint/forms/form.py +4 -4
- 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 +37 -38
- office365/sharepoint/listitems/versions/collection.py +1 -1
- office365/sharepoint/listitems/versions/version.py +18 -11
- office365/sharepoint/lists/collection.py +1 -2
- office365/sharepoint/lists/list.py +106 -153
- office365/sharepoint/marketplace/app_metadata_collection.py +3 -1
- office365/sharepoint/navigation/node.py +16 -15
- office365/sharepoint/navigation/node_collection.py +9 -3
- office365/sharepoint/permissions/base_permissions.py +11 -6
- office365/sharepoint/permissions/roles/assignments/collection.py +8 -12
- office365/sharepoint/permissions/roles/definitions/definition.py +3 -1
- office365/sharepoint/permissions/securable_object.py +38 -31
- office365/sharepoint/portal/groups/service.py +12 -16
- office365/sharepoint/portal/groups/site_manager.py +0 -1
- office365/sharepoint/principal/groups/group.py +24 -30
- office365/sharepoint/principal/principal.py +21 -19
- office365/sharepoint/principal/users/collection.py +5 -0
- office365/sharepoint/principal/users/user.py +20 -26
- office365/sharepoint/publishing/pages/collection.py +1 -4
- office365/sharepoint/publishing/pages/metadata.py +38 -51
- office365/sharepoint/publishing/pages/metadata_collection.py +5 -2
- office365/sharepoint/publishing/pages/page.py +12 -21
- office365/sharepoint/publishing/pages/reposts/repost.py +5 -9
- office365/sharepoint/publishing/pages/service.py +36 -49
- office365/sharepoint/pushnotifications/collection.py +3 -1
- office365/sharepoint/recyclebin/item.py +11 -9
- office365/sharepoint/recyclebin/item_collection.py +1 -1
- office365/sharepoint/search/service.py +8 -6
- office365/sharepoint/sharing/links/info.py +5 -2
- office365/sharepoint/sharing/links/share_response.py +3 -0
- office365/sharepoint/sharing/links/share_settings.py +3 -0
- office365/sharepoint/sharing/object_sharing_information.py +25 -19
- office365/sharepoint/sharing/object_sharing_information_user.py +10 -19
- office365/sharepoint/sharing/result.py +18 -41
- office365/sharepoint/sharing/role.py +20 -0
- office365/sharepoint/sharing/role_type.py +1 -0
- office365/sharepoint/sharing/user_sharing_result.py +12 -0
- office365/sharepoint/sites/language.py +6 -0
- office365/sharepoint/sites/language_collection.py +3 -0
- office365/sharepoint/sites/site.py +65 -86
- office365/sharepoint/storagemetrics/storage_metrics.py +5 -6
- office365/sharepoint/taxonomy/item.py +11 -10
- office365/sharepoint/taxonomy/stores/store.py +8 -8
- office365/sharepoint/taxonomy/terms/label.py +3 -0
- office365/sharepoint/taxonomy/terms/term.py +31 -0
- office365/sharepoint/tenant/administration/collaboration/insights_overview.py +10 -0
- office365/sharepoint/tenant/administration/hubsites/collection.py +1 -2
- office365/sharepoint/tenant/administration/hubsites/hub_site.py +20 -24
- 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 +69 -69
- office365/sharepoint/types/resource_path.py +2 -2
- office365/sharepoint/ui/applicationpages/peoplepicker/query_parameters.py +1 -1
- office365/sharepoint/usercustomactions/collection.py +1 -2
- office365/sharepoint/userprofiles/my_site_links.py +4 -4
- office365/sharepoint/userprofiles/people_manager.py +1 -3
- office365/sharepoint/userprofiles/user_profile.py +9 -11
- office365/sharepoint/utilities/principal_info.py +12 -0
- office365/sharepoint/viva/employee_engagement.py +1 -1
- office365/sharepoint/webparts/definition_collection.py +1 -1
- office365/sharepoint/webs/collection.py +8 -0
- office365/sharepoint/webs/template_collection.py +3 -5
- office365/sharepoint/webs/web.py +75 -95
- office365/subscriptions/collection.py +1 -1
- office365/subscriptions/subscription.py +13 -11
- office365/teams/apps/app.py +1 -0
- office365/teams/channels/channel.py +1 -3
- office365/teams/collection.py +12 -16
- office365/teams/info.py +7 -4
- 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 +18 -20
- office365/todo/attachments/base.py +7 -9
- office365/todo/linked_resource.py +6 -6
- office365/todo/tasks/list.py +1 -0
- office365/todo/tasks/task.py +3 -0
- office365/onedrive/internal/queries/resumable_file_upload.py +0 -36
- office365/outlook/internal/queries/attachment_upload.py +0 -53
- office365/runtime/odata/path_builder.py +0 -23
- office365/sharepoint/internal/key_value.py +0 -28
- office365/sharepoint/internal/queries/create_file.py +0 -20
- office365/sharepoint/internal/queries/upload_session.py +0 -103
- {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/top_level.txt +0 -0
- /office365/planner/plans/{plan_details.py → details.py} +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
2
4
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
3
5
|
from office365.sharepoint.alerts.collection import AlertCollection
|
|
4
6
|
from office365.sharepoint.principal.principal import Principal
|
|
5
7
|
from office365.sharepoint.principal.users.id_info import UserIdInfo
|
|
8
|
+
from office365.sharepoint.userprofiles.person_properties import PersonProperties
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
class User(Principal):
|
|
@@ -14,18 +17,16 @@ class User(Principal):
|
|
|
14
17
|
|
|
15
18
|
return_type = Site(self.context)
|
|
16
19
|
|
|
17
|
-
def
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
people_manager = PeopleManager(self.context)
|
|
21
|
-
person_props = people_manager.get_properties_for(self.login_name)
|
|
20
|
+
def _person_props_loaded(person_props):
|
|
21
|
+
# type: (PersonProperties) -> None
|
|
22
|
+
return_type.set_property("__siteUrl", person_props.personal_url)
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
def _get_properties_for():
|
|
25
|
+
self.context.people_manager.get_properties_for(
|
|
26
|
+
self.login_name
|
|
27
|
+
).after_execute(_person_props_loaded)
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
self.ensure_property("LoginName", _user_loaded)
|
|
29
|
+
self.ensure_property("LoginName", _get_properties_for)
|
|
29
30
|
return return_type
|
|
30
31
|
|
|
31
32
|
def get_recent_files(self, top=100):
|
|
@@ -86,9 +87,8 @@ class User(Principal):
|
|
|
86
87
|
|
|
87
88
|
@property
|
|
88
89
|
def is_site_admin(self):
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"""
|
|
90
|
+
# type: () -> Optional[bool]
|
|
91
|
+
"""Gets a Boolean value that specifies whether the user is a site collection administrator."""
|
|
92
92
|
return self.properties.get("IsSiteAdmin", None)
|
|
93
93
|
|
|
94
94
|
@property
|
|
@@ -99,51 +99,45 @@ class User(Principal):
|
|
|
99
99
|
|
|
100
100
|
@property
|
|
101
101
|
def email(self):
|
|
102
|
+
# type: () -> Optional[str]
|
|
102
103
|
"""
|
|
103
104
|
Specifies the e-mail address of the user.
|
|
104
105
|
It MUST NOT be NULL. Its length MUST be equal to or less than 255.
|
|
105
|
-
:rtype: str or None
|
|
106
106
|
"""
|
|
107
107
|
return self.properties.get("Email", None)
|
|
108
108
|
|
|
109
109
|
@property
|
|
110
110
|
def email_with_fallback(self):
|
|
111
|
-
|
|
112
|
-
:rtype: str or None
|
|
113
|
-
"""
|
|
111
|
+
# type: () -> Optional[str]
|
|
114
112
|
return self.properties.get("EmailWithFallback", None)
|
|
115
113
|
|
|
116
114
|
@property
|
|
117
115
|
def expiration(self):
|
|
118
|
-
|
|
119
|
-
:rtype: str or None
|
|
120
|
-
"""
|
|
116
|
+
# type: () -> Optional[str]
|
|
121
117
|
return self.properties.get("Expiration", None)
|
|
122
118
|
|
|
123
119
|
@property
|
|
124
120
|
def is_email_authentication_guest_user(self):
|
|
121
|
+
# type: () -> Optional[bool]
|
|
125
122
|
"""
|
|
126
123
|
Indicates whether the User is a share by email guest user using time of access authentication.
|
|
127
124
|
If this instance is an email authentication guest user, this value MUST be true, otherwise it MUST be false.
|
|
128
|
-
:rtype: bool or None
|
|
129
125
|
"""
|
|
130
126
|
return self.properties.get("IsEmailAuthenticationGuestUser", None)
|
|
131
127
|
|
|
132
128
|
@property
|
|
133
129
|
def is_share_by_email_guest_user(self):
|
|
130
|
+
# type: () -> Optional[bool]
|
|
134
131
|
"""
|
|
135
132
|
Gets a value indicating whether this User is a share by email guest user.
|
|
136
133
|
If this instance is a share by email guest user, it's true; otherwise, false.
|
|
137
|
-
:rtype: bool or None
|
|
138
134
|
"""
|
|
139
135
|
return self.properties.get("IsShareByEmailGuestUser", None)
|
|
140
136
|
|
|
141
137
|
@property
|
|
142
138
|
def user_principal_name(self):
|
|
143
|
-
|
|
144
|
-
User principal name of the user that initiated the sign-in.
|
|
145
|
-
:rtype: str or None
|
|
146
|
-
"""
|
|
139
|
+
# type: () -> Optional[str]
|
|
140
|
+
"""User principal name of the user that initiated the sign-in."""
|
|
147
141
|
return self.properties.get("UserPrincipalName", None)
|
|
148
142
|
|
|
149
143
|
def get_property(self, name, default_value=None):
|
|
@@ -12,7 +12,7 @@ from office365.sharepoint.translation.status_collection import (
|
|
|
12
12
|
)
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class SitePageCollection(SitePageMetadataCollection):
|
|
15
|
+
class SitePageCollection(SitePageMetadataCollection[SitePage]):
|
|
16
16
|
def __init__(self, context, resource_path=None):
|
|
17
17
|
"""Specifies a collection of site pages."""
|
|
18
18
|
if resource_path is None:
|
|
@@ -85,10 +85,7 @@ class SitePageCollection(SitePageMetadataCollection):
|
|
|
85
85
|
|
|
86
86
|
def get_by_name(self, name):
|
|
87
87
|
"""Gets the site page with the specified file name.
|
|
88
|
-
|
|
89
88
|
:param str name: Specifies the name of the site page.
|
|
90
|
-
|
|
91
|
-
:rtype: SitePage
|
|
92
89
|
"""
|
|
93
90
|
return self.single("FileName eq '{0}'".format(name))
|
|
94
91
|
|
|
@@ -1,18 +1,27 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from typing import TYPE_CHECKING, Optional
|
|
3
|
+
|
|
1
4
|
from office365.runtime.types.collections import StringCollection
|
|
2
5
|
from office365.sharepoint.entity import Entity
|
|
3
6
|
from office365.sharepoint.publishing.pages.version_info import SitePageVersionInfo
|
|
4
7
|
from office365.sharepoint.publishing.user_info import UserInfo
|
|
5
8
|
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from office365.sharepoint.publishing.pages.metadata_collection import (
|
|
11
|
+
SitePageMetadataCollection,
|
|
12
|
+
)
|
|
13
|
+
|
|
6
14
|
|
|
7
15
|
class SitePageMetadata(Entity):
|
|
8
16
|
"""Represents the core properties of a Site Page."""
|
|
9
17
|
|
|
18
|
+
def __repr__(self):
|
|
19
|
+
return self.file_name or self.absolute_url or self.entity_type_name
|
|
20
|
+
|
|
10
21
|
@property
|
|
11
22
|
def absolute_url(self):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
:rtype: str or None
|
|
15
|
-
"""
|
|
23
|
+
# type: () -> Optional[str]
|
|
24
|
+
"""Gets the absolute Url of the Site Page."""
|
|
16
25
|
return self.properties.get("AbsoluteUrl", None)
|
|
17
26
|
|
|
18
27
|
@property
|
|
@@ -31,84 +40,64 @@ class SitePageMetadata(Entity):
|
|
|
31
40
|
|
|
32
41
|
@property
|
|
33
42
|
def comments_disabled(self):
|
|
34
|
-
|
|
35
|
-
Indicates if comments are disabled for the current Site Page.
|
|
36
|
-
|
|
37
|
-
:rtype: bool or None
|
|
38
|
-
"""
|
|
43
|
+
# type: () -> Optional[bool]
|
|
44
|
+
"""Indicates if comments are disabled for the current Site Page."""
|
|
39
45
|
return self.properties.get("CommentsDisabled", None)
|
|
40
46
|
|
|
41
47
|
@property
|
|
42
48
|
def banner_image_url(self):
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
:rtype: str or None
|
|
46
|
-
"""
|
|
49
|
+
# type: () -> Optional[str]
|
|
50
|
+
"""Gets the banner image Url"""
|
|
47
51
|
return self.properties.get("BannerImageUrl", None)
|
|
48
52
|
|
|
49
53
|
@banner_image_url.setter
|
|
50
54
|
def banner_image_url(self, value):
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
:type value: str
|
|
54
|
-
"""
|
|
55
|
+
# type: (str) -> None
|
|
56
|
+
"""Sets the banner image Url"""
|
|
55
57
|
self.set_property("BannerImageUrl", value)
|
|
56
58
|
|
|
57
59
|
@property
|
|
58
60
|
def content_type_id(self):
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
:rtype: str or None
|
|
62
|
-
"""
|
|
61
|
+
# type: () -> Optional[str]
|
|
62
|
+
"""Gets the content type ID of the current Site Page."""
|
|
63
63
|
return self.properties.get("ContentTypeId", None)
|
|
64
64
|
|
|
65
65
|
@content_type_id.setter
|
|
66
66
|
def content_type_id(self, value):
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
:type value: str
|
|
70
|
-
"""
|
|
67
|
+
# type: (str) -> None
|
|
68
|
+
"""Sets the content type ID of the current Site Page."""
|
|
71
69
|
self.set_property("ContentTypeId", value)
|
|
72
70
|
|
|
73
71
|
@property
|
|
74
72
|
def description(self):
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
:rtype: str or None
|
|
78
|
-
"""
|
|
73
|
+
# type: () -> Optional[str]
|
|
74
|
+
"""Gets the description for the current Site Page"""
|
|
79
75
|
return self.properties.get("Description", None)
|
|
80
76
|
|
|
81
77
|
@property
|
|
82
78
|
def does_user_have_edit_permission(self):
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
:rtype: bool or None
|
|
86
|
-
"""
|
|
79
|
+
# type: () -> Optional[bool]
|
|
80
|
+
"""Indicates if the current user has edit permission to the Site Page."""
|
|
87
81
|
return self.properties.get("DoesUserHaveEditPermission", None)
|
|
88
82
|
|
|
89
83
|
@property
|
|
90
84
|
def file_name(self):
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
:rtype: str or None
|
|
94
|
-
"""
|
|
85
|
+
# type: () -> Optional[str]
|
|
86
|
+
"""Gets the file name of the current Site Page."""
|
|
95
87
|
return self.properties.get("FileName", None)
|
|
96
88
|
|
|
97
89
|
@property
|
|
98
90
|
def first_published(self):
|
|
91
|
+
# type: () -> Optional[datetime.datetime]
|
|
99
92
|
"""Datetime of when the site page was initially published.
|
|
100
93
|
The server MUST return Datetime.MinValue (00:00:00:0000000 UTC) when the site page has never been published.
|
|
101
|
-
|
|
102
|
-
:rtype: str or None
|
|
103
94
|
"""
|
|
104
95
|
return self.properties.get("FirstPublished", None)
|
|
105
96
|
|
|
106
97
|
@property
|
|
107
98
|
def is_page_checked_out_to_current_user(self):
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
:rtype: bool or None
|
|
111
|
-
"""
|
|
99
|
+
# type: () -> Optional[bool]
|
|
100
|
+
"""Indicates if the Site Page is checked out to the current user."""
|
|
112
101
|
return self.properties.get("IsPageCheckedOutToCurrentUser", None)
|
|
113
102
|
|
|
114
103
|
@property
|
|
@@ -118,16 +107,12 @@ class SitePageMetadata(Entity):
|
|
|
118
107
|
|
|
119
108
|
@property
|
|
120
109
|
def parent_collection(self):
|
|
121
|
-
|
|
122
|
-
:rtype: office365.sharepoint.publishing.pages.metadata_collection.SitePageMetadataCollection
|
|
123
|
-
"""
|
|
110
|
+
# type: () -> SitePageMetadataCollection
|
|
124
111
|
return self._parent_collection
|
|
125
112
|
|
|
126
113
|
@property
|
|
127
114
|
def topic_header(self):
|
|
128
|
-
|
|
129
|
-
:rtype: str or None
|
|
130
|
-
"""
|
|
115
|
+
# type: () -> Optional[str]
|
|
131
116
|
return self.properties.get("TopicHeader", None)
|
|
132
117
|
|
|
133
118
|
@property
|
|
@@ -146,9 +131,11 @@ class SitePageMetadata(Entity):
|
|
|
146
131
|
return super(SitePageMetadata, self).get_property(name, default_value)
|
|
147
132
|
|
|
148
133
|
def set_property(self, name, value, persist_changes=True):
|
|
149
|
-
if
|
|
150
|
-
if
|
|
134
|
+
if name == "Id":
|
|
135
|
+
if self._resource_path is None:
|
|
151
136
|
self._resource_path = self.parent_collection.get_by_id(
|
|
152
137
|
value
|
|
153
138
|
).resource_path
|
|
139
|
+
else:
|
|
140
|
+
self._resource_path.patch(value)
|
|
154
141
|
return super(SitePageMetadata, self).set_property(name, value, persist_changes)
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
from typing import TypeVar
|
|
2
|
+
|
|
1
3
|
from office365.runtime.paths.service_operation import ServiceOperationPath
|
|
2
4
|
from office365.sharepoint.entity_collection import EntityCollection
|
|
3
5
|
from office365.sharepoint.publishing.pages.metadata import SitePageMetadata
|
|
4
6
|
|
|
7
|
+
T = TypeVar("T")
|
|
8
|
+
|
|
5
9
|
|
|
6
|
-
class SitePageMetadataCollection(EntityCollection):
|
|
10
|
+
class SitePageMetadataCollection(EntityCollection[T]):
|
|
7
11
|
"""Specifies a collection of site pages."""
|
|
8
12
|
|
|
9
13
|
def get_by_id(self, site_page_id):
|
|
10
14
|
"""Gets the site page with the specified ID.
|
|
11
|
-
|
|
12
15
|
:param int site_page_id: Specifies the identifier of the site page.
|
|
13
16
|
"""
|
|
14
17
|
return SitePageMetadata(
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.runtime.client_result import ClientResult
|
|
2
4
|
from office365.runtime.client_value import ClientValue
|
|
3
5
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
@@ -163,7 +165,6 @@ class SitePage(SitePageMetadata):
|
|
|
163
165
|
def publish(self):
|
|
164
166
|
"""
|
|
165
167
|
Publishes a major version of the current Site Page. Returns TRUE on success, FALSE otherwise.
|
|
166
|
-
|
|
167
168
|
"""
|
|
168
169
|
return_type = ClientResult(self.context, bool())
|
|
169
170
|
qry = ServiceOperationQuery(self, "Publish", None, None, None, return_type)
|
|
@@ -202,42 +203,31 @@ class SitePage(SitePageMetadata):
|
|
|
202
203
|
|
|
203
204
|
@property
|
|
204
205
|
def canvas_content(self):
|
|
205
|
-
|
|
206
|
-
Gets the CanvasContent1 for the current Site Page
|
|
207
|
-
|
|
208
|
-
:rtype: str or None
|
|
209
|
-
"""
|
|
206
|
+
# type: () -> Optional[str]
|
|
207
|
+
"""Gets the CanvasContent1 for the current Site Page"""
|
|
210
208
|
return self.properties.get("CanvasContent1", None)
|
|
211
209
|
|
|
212
210
|
@canvas_content.setter
|
|
213
211
|
def canvas_content(self, value):
|
|
214
|
-
|
|
215
|
-
Sets the CanvasContent1 for the current Site Page
|
|
216
|
-
|
|
217
|
-
:rtype: str or None
|
|
218
|
-
"""
|
|
212
|
+
# type: (str) -> None
|
|
213
|
+
"""Sets the CanvasContent1 for the current Site Page"""
|
|
219
214
|
self.set_property("CanvasContent1", value)
|
|
220
215
|
|
|
221
216
|
@property
|
|
222
217
|
def layout_web_parts_content(self):
|
|
223
|
-
|
|
224
|
-
Gets the LayoutWebPartsContent field for the current Site Page.
|
|
225
|
-
|
|
226
|
-
:rtype: str or None
|
|
227
|
-
"""
|
|
218
|
+
# type: () -> Optional[str]
|
|
219
|
+
"""Gets the LayoutWebPartsContent field for the current Site Page."""
|
|
228
220
|
return self.properties.get("LayoutWebpartsContent", None)
|
|
229
221
|
|
|
230
222
|
@layout_web_parts_content.setter
|
|
231
223
|
def layout_web_parts_content(self, value):
|
|
232
|
-
|
|
233
|
-
Sets the LayoutWebPartsContent field for the current Site Page.
|
|
234
|
-
|
|
235
|
-
:rtype: str or None
|
|
236
|
-
"""
|
|
224
|
+
# type: (str) -> None
|
|
225
|
+
"""Sets the LayoutWebPartsContent field for the current Site Page."""
|
|
237
226
|
self.set_property("LayoutWebpartsContent", value)
|
|
238
227
|
|
|
239
228
|
@property
|
|
240
229
|
def translations(self):
|
|
230
|
+
# type: () -> TranslationStatusCollection
|
|
241
231
|
return self.properties.get(
|
|
242
232
|
"Translations",
|
|
243
233
|
TranslationStatusCollection(
|
|
@@ -247,4 +237,5 @@ class SitePage(SitePageMetadata):
|
|
|
247
237
|
|
|
248
238
|
@property
|
|
249
239
|
def entity_type_name(self):
|
|
240
|
+
# type: () -> str
|
|
250
241
|
return "SP.Publishing.SitePage"
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.sharepoint.publishing.pages.page import SitePage
|
|
2
4
|
|
|
3
5
|
|
|
@@ -7,23 +9,17 @@ class RepostPage(SitePage):
|
|
|
7
9
|
|
|
8
10
|
@property
|
|
9
11
|
def is_banner_image_url_external(self):
|
|
10
|
-
|
|
11
|
-
:rtype: bool or None
|
|
12
|
-
"""
|
|
12
|
+
# type: () -> Optional[bool]
|
|
13
13
|
return self.properties.get("IsBannerImageUrlExternal", None)
|
|
14
14
|
|
|
15
15
|
@property
|
|
16
16
|
def original_source_item_id(self):
|
|
17
|
-
|
|
18
|
-
:rtype: str or None
|
|
19
|
-
"""
|
|
17
|
+
# type: () -> Optional[str]
|
|
20
18
|
return self.properties.get("OriginalSourceItemId", None)
|
|
21
19
|
|
|
22
20
|
@property
|
|
23
21
|
def original_source_url(self):
|
|
24
|
-
|
|
25
|
-
:rtype: str or None
|
|
26
|
-
"""
|
|
22
|
+
# type: () -> Optional[str]
|
|
27
23
|
return self.properties.get("OriginalSourceUrl", None)
|
|
28
24
|
|
|
29
25
|
@property
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, Optional
|
|
2
|
+
|
|
1
3
|
from office365.runtime.client_result import ClientResult
|
|
2
4
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
3
5
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
@@ -7,9 +9,13 @@ from office365.sharepoint.entity import Entity
|
|
|
7
9
|
from office365.sharepoint.files.file import File
|
|
8
10
|
from office365.sharepoint.publishing.file_picker_options import FilePickerOptions
|
|
9
11
|
from office365.sharepoint.publishing.pages.collection import SitePageCollection
|
|
12
|
+
from office365.sharepoint.publishing.pages.page import SitePage
|
|
10
13
|
from office365.sharepoint.publishing.primary_city_time import PrimaryCityTime
|
|
11
14
|
from office365.sharepoint.publishing.sites.communication.site import CommunicationSite
|
|
12
15
|
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from office365.sharepoint.client_context import ClientContext
|
|
18
|
+
|
|
13
19
|
|
|
14
20
|
class SitePageService(Entity):
|
|
15
21
|
"""Represents a set of APIs to use for managing site pages."""
|
|
@@ -22,6 +28,7 @@ class SitePageService(Entity):
|
|
|
22
28
|
|
|
23
29
|
@property
|
|
24
30
|
def pages(self):
|
|
31
|
+
# type: () -> SitePageCollection
|
|
25
32
|
"""Gets the SitePageCollection for the current web."""
|
|
26
33
|
return self.properties.get(
|
|
27
34
|
"pages",
|
|
@@ -44,53 +51,45 @@ class SitePageService(Entity):
|
|
|
44
51
|
return "SP.Publishing.SitePageService"
|
|
45
52
|
|
|
46
53
|
def create_page(self, title):
|
|
54
|
+
# type: (str) -> SitePage
|
|
47
55
|
"""Create a new sitePage in the site pages list in a site.
|
|
48
|
-
|
|
49
56
|
:param str title: The title of Site Page
|
|
50
57
|
"""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
resp.raise_for_status()
|
|
65
|
-
return_type.save_draft(title=title)
|
|
66
|
-
self.context.after_execute(_draft_saved)
|
|
67
|
-
|
|
68
|
-
self.context.after_execute(_page_created)
|
|
69
|
-
return return_type
|
|
58
|
+
|
|
59
|
+
def _page_created(return_type):
|
|
60
|
+
# type: (SitePage) -> None
|
|
61
|
+
|
|
62
|
+
def _draft_saved(result):
|
|
63
|
+
# type: (ClientResult[bool]) -> None
|
|
64
|
+
pass
|
|
65
|
+
|
|
66
|
+
return_type.save_draft(title=title).after_execute(
|
|
67
|
+
_draft_saved, execute_first=True
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
return self.pages.add().after_execute(_page_created).get()
|
|
70
71
|
|
|
71
72
|
def create_and_publish_page(self, title):
|
|
72
73
|
"""
|
|
73
74
|
Create and publish a new sitePage in the site pages list in a site.
|
|
74
|
-
|
|
75
75
|
:param str title: The title of Site Page
|
|
76
76
|
"""
|
|
77
|
-
return_type = self.create_page(title)
|
|
78
77
|
|
|
79
|
-
def _page_created(
|
|
80
|
-
|
|
81
|
-
:type resp: requests.Response
|
|
82
|
-
"""
|
|
83
|
-
resp.raise_for_status()
|
|
84
|
-
return_type.publish()
|
|
78
|
+
def _page_created(return_type):
|
|
79
|
+
# type: (SitePage) -> None
|
|
85
80
|
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
def _page_published(result):
|
|
82
|
+
# type: (ClientResult[bool]) -> None
|
|
83
|
+
pass
|
|
84
|
+
|
|
85
|
+
return_type.publish().after_execute(_page_published)
|
|
86
|
+
|
|
87
|
+
return self.create_page(title).after_execute(_page_created)
|
|
88
88
|
|
|
89
89
|
def can_create_page(self):
|
|
90
90
|
"""
|
|
91
91
|
Checks if the current user has permission to create a site page on the site pages document library.
|
|
92
92
|
MUST return true if the user has permission to create a site page, otherwise MUST return false.
|
|
93
|
-
|
|
94
93
|
"""
|
|
95
94
|
return_type = ClientResult(self.context, bool())
|
|
96
95
|
qry = ServiceOperationQuery(
|
|
@@ -113,10 +112,7 @@ class SitePageService(Entity):
|
|
|
113
112
|
|
|
114
113
|
@staticmethod
|
|
115
114
|
def get_current_user_memberships(context, scenario=None):
|
|
116
|
-
|
|
117
|
-
:param office365.sharepoint.client_context.ClientContext context: Client context
|
|
118
|
-
:param str scenario:
|
|
119
|
-
"""
|
|
115
|
+
# type: (ClientContext, Optional[str]) -> ClientResult[StringCollection]
|
|
120
116
|
return_type = ClientResult(context, StringCollection())
|
|
121
117
|
svc = SitePageService(context)
|
|
122
118
|
qry = ServiceOperationQuery(
|
|
@@ -127,9 +123,9 @@ class SitePageService(Entity):
|
|
|
127
123
|
|
|
128
124
|
@staticmethod
|
|
129
125
|
def get_time_zone(context, city_name):
|
|
126
|
+
# type: (ClientContext, str) -> PrimaryCityTime
|
|
130
127
|
"""
|
|
131
128
|
Gets time zone data for specified city.
|
|
132
|
-
|
|
133
129
|
:param office365.sharepoint.client_context.ClientContext context:
|
|
134
130
|
:param str city_name: The name of the city.
|
|
135
131
|
"""
|
|
@@ -144,8 +140,8 @@ class SitePageService(Entity):
|
|
|
144
140
|
|
|
145
141
|
@staticmethod
|
|
146
142
|
def compute_file_name(context, title):
|
|
143
|
+
# type: (ClientContext, str) -> ClientResult[str]
|
|
147
144
|
"""
|
|
148
|
-
|
|
149
145
|
:param office365.sharepoint.client_context.ClientContext context: Client context
|
|
150
146
|
:param str title: The title of the page.
|
|
151
147
|
"""
|
|
@@ -164,10 +160,7 @@ class SitePageService(Entity):
|
|
|
164
160
|
|
|
165
161
|
@staticmethod
|
|
166
162
|
def is_file_picker_external_image_search_enabled(context):
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
:param office365.sharepoint.client_context.ClientContext context: Client context
|
|
170
|
-
"""
|
|
163
|
+
# type: (ClientContext) -> ClientResult[bool]
|
|
171
164
|
return_type = ClientResult(context)
|
|
172
165
|
binding_type = SitePageService(context)
|
|
173
166
|
qry = ServiceOperationQuery(
|
|
@@ -184,10 +177,7 @@ class SitePageService(Entity):
|
|
|
184
177
|
|
|
185
178
|
@staticmethod
|
|
186
179
|
def org_assets(context):
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
:param office365.sharepoint.client_context.ClientContext context: Client context
|
|
190
|
-
"""
|
|
180
|
+
# type: (ClientContext) -> ClientResult[OrgAssets]
|
|
191
181
|
return_type = ClientResult(context, OrgAssets())
|
|
192
182
|
svc = SitePageService(context)
|
|
193
183
|
qry = ServiceOperationQuery(
|
|
@@ -198,10 +188,7 @@ class SitePageService(Entity):
|
|
|
198
188
|
|
|
199
189
|
@staticmethod
|
|
200
190
|
def file_picker_tab_options(context):
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
:param office365.sharepoint.client_context.ClientContext context: Client context
|
|
204
|
-
"""
|
|
191
|
+
# type: (ClientContext) -> ClientResult[FilePickerOptions]
|
|
205
192
|
return_type = ClientResult(context, FilePickerOptions())
|
|
206
193
|
svc = SitePageService(context)
|
|
207
194
|
qry = ServiceOperationQuery(
|
|
@@ -3,7 +3,9 @@ from office365.sharepoint.entity_collection import EntityCollection
|
|
|
3
3
|
from office365.sharepoint.pushnotifications.subscriber import PushNotificationSubscriber
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class PushNotificationSubscriberCollection(
|
|
6
|
+
class PushNotificationSubscriberCollection(
|
|
7
|
+
EntityCollection[PushNotificationSubscriber]
|
|
8
|
+
):
|
|
7
9
|
"""Specifies the collection of push notification subscribers for the site"""
|
|
8
10
|
|
|
9
11
|
def __init__(self, context, resource_path=None):
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
2
4
|
from office365.runtime.paths.service_operation import ServiceOperationPath
|
|
5
|
+
from office365.runtime.paths.v3.entity import EntityPath
|
|
3
6
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
4
7
|
from office365.sharepoint.entity import Entity
|
|
5
8
|
from office365.sharepoint.principal.users.user import User
|
|
@@ -30,17 +33,13 @@ class RecycleBinItem(Entity):
|
|
|
30
33
|
|
|
31
34
|
@property
|
|
32
35
|
def size(self):
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
:rtype: long or None
|
|
36
|
-
"""
|
|
36
|
+
# type: () -> Optional[int]
|
|
37
|
+
"""Gets a value that specifies the size of the Recycle Bin item in bytes."""
|
|
37
38
|
return self.properties.get("Size", None)
|
|
38
39
|
|
|
39
40
|
@property
|
|
40
41
|
def author(self):
|
|
41
|
-
"""
|
|
42
|
-
Gets a value that specifies the user who created the Recycle Bin item.
|
|
43
|
-
"""
|
|
42
|
+
"""Gets a value that specifies the user who created the Recycle Bin item."""
|
|
44
43
|
return self.properties.get(
|
|
45
44
|
"Author", User(self.context, ResourcePath("Author", self.resource_path))
|
|
46
45
|
)
|
|
@@ -61,8 +60,11 @@ class RecycleBinItem(Entity):
|
|
|
61
60
|
def set_property(self, name, value, persist_changes=True):
|
|
62
61
|
super(RecycleBinItem, self).set_property(name, value, persist_changes)
|
|
63
62
|
# fallback: create a new resource path
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
|
|
64
|
+
if name == "Id":
|
|
65
|
+
if self._resource_path is None:
|
|
66
66
|
self._resource_path = ServiceOperationPath(
|
|
67
67
|
"GetById", [value], self._parent_collection.resource_path
|
|
68
68
|
)
|
|
69
|
+
else:
|
|
70
|
+
self._resource_path.patch(value)
|
|
@@ -5,7 +5,7 @@ from office365.sharepoint.entity_collection import EntityCollection
|
|
|
5
5
|
from office365.sharepoint.recyclebin.item import RecycleBinItem
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class RecycleBinItemCollection(EntityCollection):
|
|
8
|
+
class RecycleBinItemCollection(EntityCollection[RecycleBinItem]):
|
|
9
9
|
"""Represents a collection of View resources."""
|
|
10
10
|
|
|
11
11
|
def __init__(self, context, resource_path=None):
|