Skip to content

Commit d559b3c

Browse files
vvgrem@gmail.comvvgrem@gmail.com
authored andcommitted
SharePoint API: new types and methods
1 parent 93325ea commit d559b3c

21 files changed

+159
-11
lines changed

generator/metadata/SharePoint.xml

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

office365/sharepoint/attachments/attachmentfile_collection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def add(self, attachment_file_information):
4343
self.context.add_query(qry)
4444
return target_file
4545

46+
def add_using_path(self):
47+
pass
48+
4649
def get_by_filename(self, filename):
4750
"""Retrieve Attachment file object by filename
4851
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class ListItemCreationInformationUsingPath(ClientValue):
5+
6+
def __init__(self, leaf_name, object_type, folder_path=None):
7+
"""
8+
9+
:type leaf_name: str
10+
:type object_type: int
11+
:type folder_path: office365.sharepoint.types.resource_path.ResourcePath
12+
"""
13+
super().__init__()
14+
self.FolderPath = folder_path
15+
self.LeafName = leaf_name
16+
self.UnderlyingObjectType = object_type

office365/sharepoint/lists/list.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
from office365.sharepoint.folders.folder import Folder
1313
from office365.sharepoint.forms.form_collection import FormCollection
1414
from office365.sharepoint.listitems.caml.caml_query import CamlQuery
15+
from office365.sharepoint.listitems.listItem_creation_information_using_path import ListItemCreationInformationUsingPath
1516
from office365.sharepoint.listitems.listitem import ListItem
1617
from office365.sharepoint.listitems.listItem_collection import ListItemCollection
1718
from office365.sharepoint.permissions.securable_object import SecurableObject
1819
from office365.sharepoint.views.view import View
1920
from office365.sharepoint.views.view_collection import ViewCollection
21+
from office365.sharepoint.webhooks.subscription_collection import SubscriptionCollection
2022

2123

2224
class List(SecurableObject):
@@ -110,6 +112,22 @@ def _resolve_folder_url():
110112
self.rootFolder.ensure_property("ServerRelativeUrl", _resolve_folder_url)
111113
return item
112114

115+
def add_item_using_path(self, leaf_name, object_type, folder_url):
116+
"""
117+
:type leaf_name: str
118+
:type object_type: int
119+
:type folder_url: str
120+
"""
121+
from office365.sharepoint.types.resource_path import ResourcePath as SPResPath
122+
parameters = ListItemCreationInformationUsingPath(leaf_name, object_type, folder_path=SPResPath(folder_url))
123+
item = ListItem(self.context)
124+
qry = ServiceOperationQuery(self, "AddItemUsingPath", None, parameters, "parameters", item)
125+
self.context.add_query(qry)
126+
return item
127+
128+
def add_validate_update_item(self):
129+
pass
130+
113131
def get_item_by_id(self, item_id):
114132
"""Returns the list item with the specified list item identifier.
115133
@@ -199,6 +217,13 @@ def fields(self):
199217
else:
200218
return FieldCollection(self.context, ResourcePath("Fields", self.resource_path), self)
201219

220+
@property
221+
def subscriptions(self):
222+
"""Gets one or more webhook subscriptions on a SharePoint list."""
223+
return self.properties.get('Subscriptions',
224+
SubscriptionCollection(self.context,
225+
ResourcePath("Subscriptions", self.resource_path)))
226+
202227
@property
203228
def views(self):
204229
"""Gets a value that specifies the collection of all public views on the list and personal views

office365/sharepoint/navigation/navigation_node_collection.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from office365.runtime.client_object_collection import ClientObjectCollection
22
from office365.runtime.queries.create_entity_query import CreateEntityQuery
3+
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
34
from office365.runtime.resource_path_service_operation import ResourcePathServiceOperation
45
from office365.sharepoint.navigation.navigation_node import NavigationNode
56

@@ -23,6 +24,13 @@ def add(self, create_node_info):
2324
self.context.add_query(qry)
2425
return target_node
2526

27+
def get_by_index(self, index):
28+
target_node = NavigationNode(self.context)
29+
self.add_child(target_node)
30+
qry = ServiceOperationQuery(self, "GetByIndex", [index], None, None, target_node)
31+
self.context.add_query(qry)
32+
return target_node
33+
2634
def get_by_id(self, node_id):
2735
"""Gets the navigation node with the specified ID.
2836
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from office365.runtime.client_value import ClientValue
22

33

4-
class ListItemCreationInformationUsingPath(ClientValue):
4+
class PortalHealthStatus(ClientValue):
55
pass

office365/sharepoint/sitedesigns/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)