Office365-REST-Python-Client 2.5.2__py3-none-any.whl → 2.5.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/METADATA +18 -5
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/RECORD +135 -131
- office365/base_item.py +12 -20
- office365/communications/presences/presence.py +18 -7
- office365/delta_path.py +1 -1
- office365/directory/administrative_unit.py +6 -7
- office365/directory/applications/application.py +15 -13
- office365/directory/applications/template.py +5 -8
- office365/directory/audit/signins/signin.py +8 -12
- office365/directory/authentication/methods/details.py +8 -6
- office365/directory/authentication/methods/email.py +4 -4
- office365/directory/groups/lifecycle_policy.py +8 -7
- office365/directory/identities/provider.py +5 -6
- office365/directory/internal/paths/me.py +1 -1
- office365/directory/permissions/email_identity.py +7 -0
- office365/directory/protection/riskyusers/history_item.py +4 -3
- office365/directory/rolemanagement/role.py +5 -4
- office365/directory/rolemanagement/template.py +2 -6
- office365/directory/rolemanagement/unified_role_assignment.py +5 -4
- office365/directory/rolemanagement/unified_role_definition.py +6 -4
- office365/directory/serviceprincipals/service_principal.py +11 -6
- office365/directory/users/user.py +8 -11
- office365/entity.py +2 -2
- office365/entity_collection.py +11 -4
- office365/intune/devices/enrollment/configuration.py +6 -4
- office365/intune/devices/managed.py +9 -12
- office365/onedrive/analytics/item_activity_stat.py +4 -3
- office365/onedrive/columns/definition.py +9 -9
- office365/onedrive/documentsets/version.py +1 -3
- office365/onedrive/driveitems/driveItem.py +36 -29
- office365/onedrive/internal/paths/children.py +2 -2
- office365/onedrive/internal/paths/root.py +1 -1
- office365/onedrive/internal/paths/shared.py +11 -6
- office365/onedrive/internal/paths/site.py +3 -3
- office365/onedrive/internal/paths/url.py +2 -2
- office365/onedrive/listitems/list_item.py +2 -0
- office365/onedrive/lists/list.py +7 -4
- office365/onedrive/permissions/collection.py +26 -6
- office365/onedrive/sharepoint.py +1 -0
- office365/onedrive/shares/collection.py +2 -5
- office365/onedrive/shares/drive_item.py +5 -1
- office365/onedrive/termstore/groups/collection.py +3 -8
- office365/onedrive/termstore/groups/group.py +8 -0
- office365/onedrive/termstore/sets/collection.py +2 -6
- office365/onedrive/termstore/sets/name.py +5 -0
- office365/onedrive/termstore/sets/set.py +7 -0
- office365/onedrive/termstore/store.py +10 -13
- office365/onedrive/versions/drive_item.py +6 -8
- office365/onedrive/workbooks/functions/result.py +1 -1
- office365/onedrive/workbooks/names/collection.py +26 -0
- office365/onedrive/workbooks/names/named_item.py +23 -6
- office365/onedrive/workbooks/ranges/range.py +61 -14
- office365/onedrive/workbooks/ranges/view.py +1 -0
- office365/onedrive/workbooks/tables/table.py +11 -8
- office365/onedrive/workbooks/workbook.py +7 -11
- office365/onedrive/workbooks/worksheets/worksheet.py +5 -3
- office365/onenote/pages/collection.py +3 -2
- office365/onenote/resources/resource.py +5 -4
- office365/onenote/sectiongroups/section_group.py +10 -7
- office365/outlook/calendar/calendar.py +1 -1
- office365/outlook/calendar/schedule/information.py +0 -1
- office365/outlook/contacts/contact.py +3 -9
- office365/outlook/contacts/folder.py +3 -0
- office365/outlook/item.py +3 -4
- office365/outlook/mail/messages/message.py +25 -18
- office365/outlook/mail/recipient.py +3 -1
- office365/runtime/auth/authentication_context.py +6 -4
- office365/runtime/auth/providers/acs_token_provider.py +21 -15
- office365/runtime/auth/providers/saml_token_provider.py +5 -2
- office365/runtime/auth/sts_profile.py +5 -2
- office365/runtime/client_object.py +3 -11
- office365/runtime/client_object_collection.py +22 -20
- office365/runtime/client_result.py +1 -3
- office365/runtime/client_value_collection.py +2 -6
- office365/runtime/odata/json_format.py +1 -5
- office365/runtime/odata/query_options.py +1 -3
- office365/runtime/odata/request.py +8 -13
- office365/runtime/odata/type.py +2 -0
- office365/runtime/paths/appid.py +1 -1
- office365/runtime/{odata/url_builder.py → paths/builder.py} +24 -9
- office365/runtime/paths/item.py +1 -1
- office365/runtime/paths/resource_path.py +12 -16
- office365/runtime/paths/service_operation.py +8 -7
- office365/runtime/paths/v3/__init__.py +0 -0
- office365/runtime/paths/{key.py → v3/entity.py} +5 -5
- office365/runtime/paths/v4/__init__.py +0 -0
- office365/runtime/paths/v4/entity.py +35 -0
- office365/sharepoint/client_context.py +17 -10
- office365/sharepoint/contenttypes/content_type.py +6 -0
- office365/sharepoint/documentmanagement/document_set.py +4 -6
- office365/sharepoint/entity_collection.py +9 -0
- office365/sharepoint/features/feature.py +6 -8
- office365/sharepoint/files/checked_out_file.py +4 -2
- office365/sharepoint/files/checked_out_file_collection.py +1 -1
- office365/sharepoint/files/collection.py +35 -3
- office365/sharepoint/files/file.py +35 -11
- office365/sharepoint/files/versions/collection.py +4 -0
- office365/sharepoint/files/versions/event.py +6 -3
- office365/sharepoint/files/versions/version.py +6 -4
- office365/sharepoint/folders/collection.py +2 -2
- office365/sharepoint/folders/folder.py +5 -11
- office365/sharepoint/internal/paths/static_operation.py +9 -0
- office365/sharepoint/internal/paths/web.py +20 -0
- office365/sharepoint/listitems/collection.py +4 -0
- office365/sharepoint/listitems/listitem.py +19 -30
- office365/sharepoint/lists/list.py +44 -60
- office365/sharepoint/portal/groups/service.py +12 -16
- office365/sharepoint/portal/groups/site_manager.py +0 -1
- office365/sharepoint/publishing/pages/metadata.py +7 -2
- office365/sharepoint/publishing/pages/metadata_collection.py +0 -1
- office365/sharepoint/publishing/pages/page.py +3 -6
- office365/sharepoint/publishing/pages/reposts/repost.py +5 -9
- office365/sharepoint/recyclebin/item.py +11 -9
- office365/sharepoint/sharing/links/share_response.py +3 -0
- office365/sharepoint/sharing/result.py +18 -41
- office365/sharepoint/sites/site.py +46 -68
- office365/sharepoint/taxonomy/item.py +4 -2
- office365/sharepoint/taxonomy/stores/store.py +2 -6
- office365/sharepoint/tenant/administration/internal/permission_grant.py +7 -0
- office365/sharepoint/tenant/administration/sites/properties.py +55 -44
- office365/sharepoint/tenant/administration/tenant.py +25 -40
- office365/sharepoint/usercustomactions/collection.py +0 -1
- office365/sharepoint/webs/collection.py +8 -0
- office365/sharepoint/webs/template_collection.py +2 -4
- office365/sharepoint/webs/web.py +27 -24
- office365/teams/apps/app.py +1 -0
- office365/teams/collection.py +12 -16
- office365/teams/members/conversation_collection.py +1 -3
- office365/teams/operations/async_operation.py +3 -5
- office365/teams/schedule/groups/group.py +3 -0
- office365/teams/team.py +1 -1
- office365/todo/attachments/base.py +7 -9
- office365/runtime/odata/path_builder.py +0 -23
- office365/runtime/paths/entity.py +0 -34
- office365/sharepoint/internal/key_value.py +0 -28
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.4.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
1
3
|
from office365.directory.permissions.identity import Identity
|
|
2
4
|
from office365.entity import Entity
|
|
3
5
|
from office365.entity_collection import EntityCollection
|
|
4
6
|
from office365.onedrive.permissions.permission import Permission
|
|
5
7
|
from office365.runtime.queries.create_entity import CreateEntityQuery
|
|
6
8
|
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from office365.directory.applications.application import Application
|
|
11
|
+
from office365.directory.groups.group import Group
|
|
12
|
+
from office365.directory.users.user import User
|
|
13
|
+
from office365.intune.devices.device import Device
|
|
14
|
+
|
|
7
15
|
|
|
8
16
|
class PermissionCollection(EntityCollection[Permission]):
|
|
9
17
|
"""Permission's collection"""
|
|
@@ -12,6 +20,7 @@ class PermissionCollection(EntityCollection[Permission]):
|
|
|
12
20
|
super(PermissionCollection, self).__init__(context, Permission, resource_path)
|
|
13
21
|
|
|
14
22
|
def add(self, roles, identity=None, identity_type=None):
|
|
23
|
+
# type: (list[str], Application|User|Group|Device|str, str) -> Permission
|
|
15
24
|
"""
|
|
16
25
|
Create a new permission object.
|
|
17
26
|
|
|
@@ -21,6 +30,7 @@ class PermissionCollection(EntityCollection[Permission]):
|
|
|
21
30
|
"""
|
|
22
31
|
|
|
23
32
|
return_type = Permission(self.context)
|
|
33
|
+
self.add_child(return_type)
|
|
24
34
|
|
|
25
35
|
known_identities = {
|
|
26
36
|
"application": self.context.applications,
|
|
@@ -41,7 +51,7 @@ class PermissionCollection(EntityCollection[Permission]):
|
|
|
41
51
|
raise ValueError("Unknown identity type")
|
|
42
52
|
identity = known_identity[identity]
|
|
43
53
|
|
|
44
|
-
def
|
|
54
|
+
def _add():
|
|
45
55
|
payload = {
|
|
46
56
|
"roles": roles,
|
|
47
57
|
"grantedToIdentities": [
|
|
@@ -53,17 +63,27 @@ class PermissionCollection(EntityCollection[Permission]):
|
|
|
53
63
|
],
|
|
54
64
|
}
|
|
55
65
|
|
|
56
|
-
self.add_child(return_type)
|
|
57
66
|
qry = CreateEntityQuery(self, payload, return_type)
|
|
58
67
|
self.context.add_query(qry)
|
|
59
68
|
|
|
60
|
-
identity.ensure_properties(["displayName"],
|
|
69
|
+
identity.ensure_properties(["displayName"], _add)
|
|
61
70
|
return return_type
|
|
62
71
|
|
|
72
|
+
def delete(self, roles, identity):
|
|
73
|
+
# type: (list[str], Application|User|Group|Device) -> Permission
|
|
74
|
+
"""Deletes the permission."""
|
|
75
|
+
|
|
76
|
+
def _delete(col):
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
def _identity_loaded():
|
|
80
|
+
self.get_all(page_loaded=_delete)
|
|
81
|
+
|
|
82
|
+
identity.ensure_property("id", _identity_loaded)
|
|
83
|
+
return self
|
|
84
|
+
|
|
63
85
|
def delete_all(self):
|
|
64
|
-
"""
|
|
65
|
-
Remove all access to resource
|
|
66
|
-
"""
|
|
86
|
+
"""Remove all access to resource"""
|
|
67
87
|
|
|
68
88
|
def _after_loaded(return_type):
|
|
69
89
|
# type: (PermissionCollection) -> None
|
office365/onedrive/sharepoint.py
CHANGED
|
@@ -8,9 +8,6 @@ class SharesCollection(EntityCollection[SharedDriveItem]):
|
|
|
8
8
|
super(SharesCollection, self).__init__(context, SharedDriveItem, resource_path)
|
|
9
9
|
|
|
10
10
|
def by_url(self, url):
|
|
11
|
-
|
|
12
|
-
Address shared item by absolute url
|
|
13
|
-
|
|
14
|
-
:type url: str
|
|
15
|
-
"""
|
|
11
|
+
# type: (str) -> SharedDriveItem
|
|
12
|
+
"""Address shared item by absolute url"""
|
|
16
13
|
return SharedDriveItem(self.context, SharedPath(url, self.resource_path))
|
|
@@ -8,6 +8,7 @@ from office365.onedrive.lists.list import List
|
|
|
8
8
|
from office365.onedrive.permissions.permission import Permission
|
|
9
9
|
from office365.onedrive.sites.site import Site
|
|
10
10
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
11
|
+
from office365.runtime.paths.v4.entity import EntityPath
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class SharedDriveItem(BaseItem):
|
|
@@ -26,6 +27,7 @@ class SharedDriveItem(BaseItem):
|
|
|
26
27
|
|
|
27
28
|
@property
|
|
28
29
|
def list_item(self):
|
|
30
|
+
# type: () -> ListItem
|
|
29
31
|
"""Used to access the underlying listItem"""
|
|
30
32
|
return self.properties.get(
|
|
31
33
|
"listItem",
|
|
@@ -34,6 +36,7 @@ class SharedDriveItem(BaseItem):
|
|
|
34
36
|
|
|
35
37
|
@property
|
|
36
38
|
def list(self):
|
|
39
|
+
# type: () -> List
|
|
37
40
|
"""Used to access the underlying list"""
|
|
38
41
|
return self.properties.get(
|
|
39
42
|
"list", List(self.context, ResourcePath("list", self.resource_path))
|
|
@@ -41,10 +44,11 @@ class SharedDriveItem(BaseItem):
|
|
|
41
44
|
|
|
42
45
|
@property
|
|
43
46
|
def drive_item(self):
|
|
47
|
+
# type: () -> DriveItem
|
|
44
48
|
"""Used to access the underlying driveItem"""
|
|
45
49
|
return self.properties.get(
|
|
46
50
|
"driveItem",
|
|
47
|
-
DriveItem(self.context,
|
|
51
|
+
DriveItem(self.context, EntityPath("driveItem", self.resource_path)),
|
|
48
52
|
)
|
|
49
53
|
|
|
50
54
|
@property
|
|
@@ -2,24 +2,19 @@ from office365.entity_collection import EntityCollection
|
|
|
2
2
|
from office365.onedrive.termstore.groups.group import Group
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
class GroupCollection(EntityCollection):
|
|
5
|
+
class GroupCollection(EntityCollection[Group]):
|
|
6
6
|
def __init__(self, context, resource_path=None):
|
|
7
7
|
super(GroupCollection, self).__init__(context, Group, resource_path)
|
|
8
8
|
|
|
9
9
|
def add(self, display_name):
|
|
10
10
|
"""
|
|
11
11
|
Create a new group object in a term store.
|
|
12
|
-
|
|
13
12
|
:param str display_name: Name of the group to be created.
|
|
14
|
-
:rtype: Group
|
|
15
13
|
"""
|
|
16
14
|
props = {"displayName": display_name}
|
|
17
15
|
return super(GroupCollection, self).add(**props)
|
|
18
16
|
|
|
19
17
|
def get_by_name(self, name):
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
:param str name: Group name
|
|
23
|
-
:rtype: Group
|
|
24
|
-
"""
|
|
18
|
+
# type: (str) -> Group
|
|
19
|
+
"""Returns the group with the specified name."""
|
|
25
20
|
return self.single("displayName eq '{0}'".format(name))
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.entity import Entity
|
|
2
4
|
from office365.onedrive.termstore.sets.collection import SetCollection
|
|
3
5
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
@@ -6,18 +8,24 @@ from office365.runtime.paths.resource_path import ResourcePath
|
|
|
6
8
|
class Group(Entity):
|
|
7
9
|
"""Term Group"""
|
|
8
10
|
|
|
11
|
+
def __str__(self):
|
|
12
|
+
return self.display_name
|
|
13
|
+
|
|
9
14
|
@property
|
|
10
15
|
def display_name(self):
|
|
16
|
+
# type: () -> Optional[str]
|
|
11
17
|
"""Name of the group."""
|
|
12
18
|
return self.properties.get("displayName", None)
|
|
13
19
|
|
|
14
20
|
@property
|
|
15
21
|
def parent_site_id(self):
|
|
22
|
+
# type: () -> Optional[str]
|
|
16
23
|
"""ID of the parent site of this group."""
|
|
17
24
|
return self.properties.get("parentSiteId", None)
|
|
18
25
|
|
|
19
26
|
@property
|
|
20
27
|
def sets(self):
|
|
28
|
+
# type: () -> SetCollection
|
|
21
29
|
"""Collection of all sets available in the term store."""
|
|
22
30
|
return self.properties.get(
|
|
23
31
|
"sets",
|
|
@@ -14,12 +14,8 @@ class SetCollection(EntityCollection[Set]):
|
|
|
14
14
|
self._parent_group = parent_group
|
|
15
15
|
|
|
16
16
|
def get_by_name(self, name):
|
|
17
|
-
|
|
18
|
-
Returns the TermSet specified by its name.
|
|
19
|
-
|
|
20
|
-
:param str name: Term set name
|
|
21
|
-
:rtype: Set
|
|
22
|
-
"""
|
|
17
|
+
# type: (str) -> Set
|
|
18
|
+
"""Returns the TermSet specified by its name."""
|
|
23
19
|
return self.single("displayName eq '{0}'".format(name))
|
|
24
20
|
|
|
25
21
|
def add(self, name, parent_group=None):
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
1
3
|
from office365.runtime.client_value import ClientValue
|
|
2
4
|
|
|
3
5
|
|
|
@@ -15,3 +17,6 @@ class LocalizedName(ClientValue):
|
|
|
15
17
|
super(LocalizedName, self).__init__()
|
|
16
18
|
self.name = name
|
|
17
19
|
self.languageTag = language_tag
|
|
20
|
+
|
|
21
|
+
def __repr__(self):
|
|
22
|
+
return json.dumps(self.to_json())
|
|
@@ -14,8 +14,12 @@ class Set(Entity):
|
|
|
14
14
|
terms. A group can contain multiple sets.
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
|
+
def __repr__(self):
|
|
18
|
+
return repr(self.localized_names)
|
|
19
|
+
|
|
17
20
|
@property
|
|
18
21
|
def children(self):
|
|
22
|
+
# type: () -> TermCollection
|
|
19
23
|
"""Children terms of set in term store."""
|
|
20
24
|
return self.properties.get(
|
|
21
25
|
"children",
|
|
@@ -28,6 +32,7 @@ class Set(Entity):
|
|
|
28
32
|
|
|
29
33
|
@property
|
|
30
34
|
def localized_names(self):
|
|
35
|
+
# type: () -> ClientValueCollection[LocalizedName]
|
|
31
36
|
""""""
|
|
32
37
|
return self.properties.get(
|
|
33
38
|
"localizedNames", ClientValueCollection(LocalizedName)
|
|
@@ -45,6 +50,7 @@ class Set(Entity):
|
|
|
45
50
|
|
|
46
51
|
@property
|
|
47
52
|
def relations(self):
|
|
53
|
+
# type: () -> EntityCollection[Relation]
|
|
48
54
|
"""Indicates which terms have been pinned or reused directly under the set."""
|
|
49
55
|
return self.properties.get(
|
|
50
56
|
"relations",
|
|
@@ -55,6 +61,7 @@ class Set(Entity):
|
|
|
55
61
|
|
|
56
62
|
@property
|
|
57
63
|
def terms(self):
|
|
64
|
+
# type: () -> TermCollection
|
|
58
65
|
"""All the terms under the set."""
|
|
59
66
|
return self.properties.get(
|
|
60
67
|
"terms",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.entity import Entity
|
|
2
4
|
from office365.entity_collection import EntityCollection
|
|
3
5
|
from office365.onedrive.termstore.groups.collection import GroupCollection
|
|
@@ -15,17 +17,13 @@ class Store(Entity):
|
|
|
15
17
|
"""Returns a collection containing a flat list of all TermSet objects."""
|
|
16
18
|
return_type = EntityCollection(self.context, Set)
|
|
17
19
|
|
|
18
|
-
def _sets_loaded(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"""
|
|
22
|
-
[return_type.add_child(s) for s in group_sets]
|
|
20
|
+
def _sets_loaded(sets):
|
|
21
|
+
# type: (SetCollection) -> None
|
|
22
|
+
[return_type.add_child(s) for s in sets]
|
|
23
23
|
|
|
24
24
|
def _groups_loaded(groups):
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"""
|
|
28
|
-
for g in groups: # type: Group
|
|
25
|
+
# type: (GroupCollection) -> None
|
|
26
|
+
for g in groups:
|
|
29
27
|
self.context.load(g.sets, after_loaded=_sets_loaded)
|
|
30
28
|
|
|
31
29
|
self.context.load(self.groups, after_loaded=_groups_loaded)
|
|
@@ -34,10 +32,8 @@ class Store(Entity):
|
|
|
34
32
|
|
|
35
33
|
@property
|
|
36
34
|
def default_language_tag(self):
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
:rtype: str
|
|
40
|
-
"""
|
|
35
|
+
# type: () -> Optional[str]
|
|
36
|
+
"""Default language of the term store."""
|
|
41
37
|
return self.properties.get("defaultLanguageTag", None)
|
|
42
38
|
|
|
43
39
|
@property
|
|
@@ -47,6 +43,7 @@ class Store(Entity):
|
|
|
47
43
|
|
|
48
44
|
@property
|
|
49
45
|
def groups(self):
|
|
46
|
+
# type: () -> GroupCollection
|
|
50
47
|
"""Collection of all groups available in the term store."""
|
|
51
48
|
return self.properties.get(
|
|
52
49
|
"groups",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import AnyStr, Optional
|
|
2
|
+
|
|
1
3
|
from office365.onedrive.versions.base_item import BaseItemVersion
|
|
2
4
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
3
5
|
|
|
@@ -15,16 +17,12 @@ class DriveItemVersion(BaseItemVersion):
|
|
|
15
17
|
|
|
16
18
|
@property
|
|
17
19
|
def content(self):
|
|
18
|
-
|
|
19
|
-
The content stream for this version of the item.
|
|
20
|
-
:rtype: str or bytes
|
|
21
|
-
"""
|
|
20
|
+
# type: () -> Optional[AnyStr]
|
|
21
|
+
"""The content stream for this version of the item."""
|
|
22
22
|
return self.properties.get("content", None)
|
|
23
23
|
|
|
24
24
|
@property
|
|
25
25
|
def size(self):
|
|
26
|
-
|
|
27
|
-
Indicates the size of the content stream for this version of the item.
|
|
28
|
-
:rtype: int
|
|
29
|
-
"""
|
|
26
|
+
# type: () -> Optional[int]
|
|
27
|
+
"""Indicates the size of the content stream for this version of the item."""
|
|
30
28
|
return self.properties.get("size", None)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from office365.entity_collection import EntityCollection
|
|
2
|
+
from office365.onedrive.workbooks.names.named_item import WorkbookNamedItem
|
|
3
|
+
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class WorkbookNamedItemCollection(EntityCollection[WorkbookNamedItem]):
|
|
7
|
+
def __init__(self, context, resource_path=None):
|
|
8
|
+
super(WorkbookNamedItemCollection, self).__init__(
|
|
9
|
+
context, WorkbookNamedItem, resource_path
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
def add(self, name, reference, comment=None):
|
|
13
|
+
"""
|
|
14
|
+
Adds a new name to the collection of the given scope using the user's locale for the formula.
|
|
15
|
+
|
|
16
|
+
:param str name: The name of the object.
|
|
17
|
+
:param str reference: Represents the formula that the name is defined to refer to.
|
|
18
|
+
For example, =Sheet14!$B$2:$H$12, =4.75,
|
|
19
|
+
:param str comment: Represents the comment associated with this name.
|
|
20
|
+
"""
|
|
21
|
+
return_type = WorkbookNamedItem(self.context)
|
|
22
|
+
self.add_child(return_type)
|
|
23
|
+
payload = {"name": name, "reference": reference, "comment": comment}
|
|
24
|
+
qry = ServiceOperationQuery(self, "add", None, payload, None, return_type)
|
|
25
|
+
self.context.add_query(qry)
|
|
26
|
+
return return_type
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.entity import Entity
|
|
4
|
+
from office365.onedrive.workbooks.ranges.range import WorkbookRange
|
|
2
5
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
6
|
+
from office365.runtime.queries.function import FunctionQuery
|
|
3
7
|
|
|
4
8
|
|
|
5
9
|
class WorkbookNamedItem(Entity):
|
|
@@ -7,18 +11,26 @@ class WorkbookNamedItem(Entity):
|
|
|
7
11
|
(as seen in the type below), range object, reference to a range. This object can be used to obtain range
|
|
8
12
|
object associated with names."""
|
|
9
13
|
|
|
14
|
+
def range(self):
|
|
15
|
+
"""Returns the range object that is associated with the name. Throws an exception if the named item's type
|
|
16
|
+
isn't a range."""
|
|
17
|
+
return_type = WorkbookRange(
|
|
18
|
+
self.context, ResourcePath("range", self.resource_path)
|
|
19
|
+
)
|
|
20
|
+
qry = FunctionQuery(self, "range", return_type=return_type)
|
|
21
|
+
self.context.add_query(qry)
|
|
22
|
+
return return_type
|
|
23
|
+
|
|
10
24
|
@property
|
|
11
25
|
def name(self):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"""
|
|
26
|
+
# type: () -> Optional[str]
|
|
27
|
+
"""The name of the object."""
|
|
15
28
|
return self.properties.get("name", None)
|
|
16
29
|
|
|
17
30
|
@property
|
|
18
31
|
def comment(self):
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"""
|
|
32
|
+
# type: () -> Optional[str]
|
|
33
|
+
"""Represents the comment associated with this name."""
|
|
22
34
|
return self.properties.get("comment", None)
|
|
23
35
|
|
|
24
36
|
@property
|
|
@@ -33,3 +45,8 @@ class WorkbookNamedItem(Entity):
|
|
|
33
45
|
self.context, ResourcePath("worksheet", self.resource_path)
|
|
34
46
|
),
|
|
35
47
|
)
|
|
48
|
+
|
|
49
|
+
@property
|
|
50
|
+
def property_ref_name(self):
|
|
51
|
+
# type: () -> str
|
|
52
|
+
return "name"
|
|
@@ -1,16 +1,55 @@
|
|
|
1
|
+
from typing import List, Optional
|
|
2
|
+
|
|
1
3
|
from office365.entity import Entity
|
|
2
4
|
from office365.onedrive.workbooks.ranges.format import WorkbookRangeFormat
|
|
3
5
|
from office365.onedrive.workbooks.ranges.sort import WorkbookRangeSort
|
|
4
6
|
from office365.onedrive.workbooks.ranges.view import WorkbookRangeView
|
|
5
7
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
6
8
|
from office365.runtime.queries.function import FunctionQuery
|
|
9
|
+
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
7
10
|
|
|
8
11
|
|
|
9
12
|
class WorkbookRange(Entity):
|
|
10
13
|
"""Range represents a set of one or more contiguous cells such as a cell, a row, a column, block of cells, etc."""
|
|
11
14
|
|
|
15
|
+
def cell(self, row, column):
|
|
16
|
+
"""
|
|
17
|
+
Gets the range object containing the single cell based on row and column numbers. The cell can be outside
|
|
18
|
+
the bounds of its parent range, so long as it's stays within the worksheet grid.
|
|
19
|
+
:param int row: Row number of the cell to be retrieved. Zero-indexed.
|
|
20
|
+
:param int column: Column number of the cell to be retrieved. Zero-indexed.
|
|
21
|
+
"""
|
|
22
|
+
return_type = WorkbookRange(self.context)
|
|
23
|
+
params = {"row": row, "column": column}
|
|
24
|
+
qry = FunctionQuery(self, "cell", params, return_type=return_type)
|
|
25
|
+
self.context.add_query(qry)
|
|
26
|
+
return return_type
|
|
27
|
+
|
|
28
|
+
def clear(self, apply_to=None):
|
|
29
|
+
"""Clear range values such as format, fill, and border.
|
|
30
|
+
:param str apply_to:
|
|
31
|
+
"""
|
|
32
|
+
payload = {"applyTo": apply_to}
|
|
33
|
+
qry = ServiceOperationQuery(self, "clear", parameters_type=payload)
|
|
34
|
+
self.context.add_query(qry)
|
|
35
|
+
return self
|
|
36
|
+
|
|
37
|
+
def insert(self, shift):
|
|
38
|
+
"""
|
|
39
|
+
Inserts a cell or a range of cells into the worksheet in place of this range, and shifts the other cells to
|
|
40
|
+
make space. Returns a new Range object at the now blank space.
|
|
41
|
+
:param str shift: Specifies which way to shift the cells. The possible values are: Down, Right.
|
|
42
|
+
"""
|
|
43
|
+
return_type = WorkbookRange(self.context)
|
|
44
|
+
payload = {"shift": shift}
|
|
45
|
+
qry = ServiceOperationQuery(
|
|
46
|
+
self, "insert", parameters_type=payload, return_type=return_type
|
|
47
|
+
)
|
|
48
|
+
self.context.add_query(qry)
|
|
49
|
+
return return_type
|
|
50
|
+
|
|
12
51
|
def visible_view(self):
|
|
13
|
-
""""""
|
|
52
|
+
"""Get the range visible from a filtered range."""
|
|
14
53
|
return_type = WorkbookRangeView(self.context)
|
|
15
54
|
qry = FunctionQuery(self, "visibleView", return_type=return_type)
|
|
16
55
|
self.context.add_query(qry)
|
|
@@ -18,35 +57,29 @@ class WorkbookRange(Entity):
|
|
|
18
57
|
|
|
19
58
|
@property
|
|
20
59
|
def address(self):
|
|
60
|
+
# type: () -> Optional[str]
|
|
21
61
|
"""
|
|
22
62
|
Represents the range reference in A1-style. Address value will contain the Sheet reference
|
|
23
63
|
(e.g. Sheet1!A1:B4)
|
|
24
|
-
:rtype: str or None
|
|
25
64
|
"""
|
|
26
65
|
return self.properties.get("address", None)
|
|
27
66
|
|
|
28
67
|
@property
|
|
29
68
|
def address_local(self):
|
|
30
|
-
|
|
31
|
-
Represents range reference for the specified range in the language of the user.
|
|
32
|
-
:rtype: str or None
|
|
33
|
-
"""
|
|
69
|
+
# type: () -> Optional[str]
|
|
70
|
+
"""Represents range reference for the specified range in the language of the user."""
|
|
34
71
|
return self.properties.get("addressLocal", None)
|
|
35
72
|
|
|
36
73
|
@property
|
|
37
74
|
def cell_count(self):
|
|
38
|
-
|
|
39
|
-
Number of cells in the range. Read-only.
|
|
40
|
-
:rtype: int or None
|
|
41
|
-
"""
|
|
75
|
+
# type: () -> Optional[int]
|
|
76
|
+
"""Number of cells in the range. Read-only."""
|
|
42
77
|
return self.properties.get("cellCount", None)
|
|
43
78
|
|
|
44
79
|
@property
|
|
45
80
|
def column_count(self):
|
|
46
|
-
|
|
47
|
-
Represents the total number of columns in the range. Read-only.
|
|
48
|
-
:rtype: int or None
|
|
49
|
-
"""
|
|
81
|
+
# type: () -> Optional[int]
|
|
82
|
+
"""Represents the total number of columns in the range. Read-only."""
|
|
50
83
|
return self.properties.get("columnCount", None)
|
|
51
84
|
|
|
52
85
|
@property
|
|
@@ -67,6 +100,20 @@ class WorkbookRange(Entity):
|
|
|
67
100
|
WorkbookRangeSort(self.context, ResourcePath("sort", self.resource_path)),
|
|
68
101
|
)
|
|
69
102
|
|
|
103
|
+
@property
|
|
104
|
+
def values(self):
|
|
105
|
+
# type: () -> List
|
|
106
|
+
"""Represents the raw values of the specified range. The data returned could be of type string, number,
|
|
107
|
+
or a boolean. Cell that contains an error returns the error string."""
|
|
108
|
+
return self.properties.get("values", None)
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def value_types(self):
|
|
112
|
+
# type: () -> List
|
|
113
|
+
"""Represents the type of data of each cell. The possible values are:
|
|
114
|
+
Unknown, Empty, String, Integer, Double, Boolean, Error."""
|
|
115
|
+
return self.properties.get("valueTypes", None)
|
|
116
|
+
|
|
70
117
|
@property
|
|
71
118
|
def worksheet(self):
|
|
72
119
|
"""The worksheet containing the current range"""
|
|
@@ -16,16 +16,23 @@ from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
|
16
16
|
class WorkbookTable(Entity):
|
|
17
17
|
"""Represents an Excel table."""
|
|
18
18
|
|
|
19
|
+
def __repr__(self):
|
|
20
|
+
return self.name or self.id or self.entity_type_name
|
|
21
|
+
|
|
19
22
|
def data_body_range(self):
|
|
20
23
|
"""Gets the range object associated with the data body of the table."""
|
|
21
|
-
return_type = WorkbookRange(
|
|
24
|
+
return_type = WorkbookRange(
|
|
25
|
+
self.context, ResourcePath("dataBodyRange", self.resource_path)
|
|
26
|
+
)
|
|
22
27
|
qry = FunctionQuery(self, "dataBodyRange", return_type=return_type)
|
|
23
28
|
self.context.add_query(qry)
|
|
24
29
|
return return_type
|
|
25
30
|
|
|
26
31
|
def range(self):
|
|
27
32
|
"""Get the range object associated with the entire table."""
|
|
28
|
-
return_type = WorkbookRange(
|
|
33
|
+
return_type = WorkbookRange(
|
|
34
|
+
self.context, ResourcePath("range", self.resource_path)
|
|
35
|
+
)
|
|
29
36
|
qry = FunctionQuery(self, "range", return_type=return_type)
|
|
30
37
|
self.context.add_query(qry)
|
|
31
38
|
return return_type
|
|
@@ -58,9 +65,7 @@ class WorkbookTable(Entity):
|
|
|
58
65
|
@property
|
|
59
66
|
def columns(self):
|
|
60
67
|
# type: () -> WorkbookTableColumnCollection
|
|
61
|
-
"""
|
|
62
|
-
Represents a collection of all the columns in the table.
|
|
63
|
-
"""
|
|
68
|
+
"""Represents a collection of all the columns in the table."""
|
|
64
69
|
return self.properties.get(
|
|
65
70
|
"columns",
|
|
66
71
|
WorkbookTableColumnCollection(
|
|
@@ -71,9 +76,7 @@ class WorkbookTable(Entity):
|
|
|
71
76
|
@property
|
|
72
77
|
def rows(self):
|
|
73
78
|
# type: () -> WorkbookTableRowCollection
|
|
74
|
-
"""
|
|
75
|
-
Represents a collection of all the rows in the table.
|
|
76
|
-
"""
|
|
79
|
+
"""Represents a collection of all the rows in the table."""
|
|
77
80
|
return self.properties.get(
|
|
78
81
|
"rows",
|
|
79
82
|
WorkbookTableRowCollection(
|
|
@@ -3,7 +3,7 @@ from office365.entity_collection import EntityCollection
|
|
|
3
3
|
from office365.onedrive.workbooks.applications.application import WorkbookApplication
|
|
4
4
|
from office365.onedrive.workbooks.comments.comment import WorkbookComment
|
|
5
5
|
from office365.onedrive.workbooks.functions.functions import WorkbookFunctions
|
|
6
|
-
from office365.onedrive.workbooks.names.
|
|
6
|
+
from office365.onedrive.workbooks.names.collection import WorkbookNamedItemCollection
|
|
7
7
|
from office365.onedrive.workbooks.operations.workbook import WorkbookOperation
|
|
8
8
|
from office365.onedrive.workbooks.session_info import WorkbookSessionInfo
|
|
9
9
|
from office365.onedrive.workbooks.tables.collection import WorkbookTableCollection
|
|
@@ -11,6 +11,7 @@ from office365.onedrive.workbooks.worksheets.collection import (
|
|
|
11
11
|
WorkbookWorksheetCollection,
|
|
12
12
|
)
|
|
13
13
|
from office365.runtime.client_result import ClientResult
|
|
14
|
+
from office365.runtime.http.request_options import RequestOptions
|
|
14
15
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
15
16
|
from office365.runtime.queries.function import FunctionQuery
|
|
16
17
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
@@ -56,9 +57,7 @@ class Workbook(Entity):
|
|
|
56
57
|
self.context.add_query(qry)
|
|
57
58
|
|
|
58
59
|
def _construct_request(request):
|
|
59
|
-
|
|
60
|
-
:type request: office365.runtime.http.request_options.RequestOptions
|
|
61
|
-
"""
|
|
60
|
+
# type: (RequestOptions) -> None
|
|
62
61
|
request.set_header("workbook-session-id", session_id)
|
|
63
62
|
|
|
64
63
|
self.context.before_execute(_construct_request)
|
|
@@ -66,15 +65,12 @@ class Workbook(Entity):
|
|
|
66
65
|
|
|
67
66
|
def close_session(self, session_id):
|
|
68
67
|
"""Use this API to close an existing workbook session.
|
|
69
|
-
|
|
70
68
|
:param str session_id: Identifier of the workbook session
|
|
71
69
|
"""
|
|
72
70
|
qry = ServiceOperationQuery(self, "closeSession")
|
|
73
71
|
|
|
74
72
|
def _construct_request(request):
|
|
75
|
-
|
|
76
|
-
:type request: office365.runtime.http.request_options.RequestOptions
|
|
77
|
-
"""
|
|
73
|
+
# type: (RequestOptions) -> None
|
|
78
74
|
request.set_header("workbook-session-id", session_id)
|
|
79
75
|
|
|
80
76
|
self.context.before_execute(_construct_request)
|
|
@@ -93,6 +89,7 @@ class Workbook(Entity):
|
|
|
93
89
|
|
|
94
90
|
@property
|
|
95
91
|
def comments(self):
|
|
92
|
+
# type: () -> EntityCollection[WorkbookComment]
|
|
96
93
|
""""""
|
|
97
94
|
return self.properties.get(
|
|
98
95
|
"comments",
|
|
@@ -126,13 +123,12 @@ class Workbook(Entity):
|
|
|
126
123
|
|
|
127
124
|
@property
|
|
128
125
|
def names(self):
|
|
129
|
-
# type: () ->
|
|
126
|
+
# type: () -> WorkbookNamedItemCollection
|
|
130
127
|
"""Represents a collection of workbook scoped named items (named ranges and constants). Read-only."""
|
|
131
128
|
return self.properties.get(
|
|
132
129
|
"names",
|
|
133
|
-
|
|
130
|
+
WorkbookNamedItemCollection(
|
|
134
131
|
self.context,
|
|
135
|
-
WorkbookNamedItem,
|
|
136
132
|
ResourcePath("names", self.resource_path),
|
|
137
133
|
),
|
|
138
134
|
)
|