Skip to content

Commit 2e336e6

Browse files
committed
Release 2.1.6
1 parent b0615c8 commit 2e336e6

File tree

5 files changed

+87
-3
lines changed

5 files changed

+87
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from office365.onedrive.columnDefinition import ColumnDefinition
2+
from office365.runtime.client_object_collection import ClientObjectCollection
3+
4+
5+
class ColumnDefinitionCollection(ClientObjectCollection):
6+
"""Drive column's collection"""
7+
8+
def __init__(self, context, resource_path=None):
9+
super(ColumnDefinitionCollection, self).__init__(context, ColumnDefinition, resource_path)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from office365.onedrive.contentType import ContentType
2+
from office365.runtime.client_object_collection import ClientObjectCollection
3+
4+
5+
class ContentTypeCollection(ClientObjectCollection):
6+
"""Drive column's collection"""
7+
8+
def __init__(self, context, resource_path=None):
9+
super(ContentTypeCollection, self).__init__(context, ContentType, resource_path)

office365/onedrive/list.py

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
from office365.onedrive.baseItem import BaseItem
2-
from office365.onedrive.listItemCollection import ListItemCollection
32
from office365.runtime.resource_path_entity import ResourcePathEntity
3+
from office365.onedrive.columnDefinitionCollection import ColumnDefinitionCollection
4+
from office365.onedrive.contentTypeCollection import ContentTypeCollection
5+
from office365.onedrive.listItemCollection import ListItemCollection
46

57

68
class List(BaseItem):
79
"""The list resource represents a list in a site. This resource contains the top level properties of the list,
810
including template and field definitions. """
911

12+
@property
13+
def sharepointids(self):
14+
"""Returns identifiers useful for SharePoint REST compatibility."""
15+
if self.is_property_available("sharepointIds"):
16+
return self.properties['sharepointIds']
17+
return None
18+
1019
@property
1120
def drive(self):
1221
"""Only present on document libraries. Allows access to the list as a drive resource with driveItems."""
@@ -16,6 +25,24 @@ def drive(self):
1625
from office365.onedrive.drive import Drive
1726
return Drive(self.context, ResourcePathEntity(self.context, self.resourcePath, "drive"))
1827

28+
@property
29+
def columns(self):
30+
"""The collection of columns under this site."""
31+
if self.is_property_available('columns'):
32+
return self.properties['columns']
33+
else:
34+
return ColumnDefinitionCollection(self.context,
35+
ResourcePathEntity(self.context, self.resourcePath, "columns"))
36+
37+
@property
38+
def contentTypes(self):
39+
"""The collection of content types under this site."""
40+
if self.is_property_available('contentTypes'):
41+
return self.properties['contentTypes']
42+
else:
43+
return ContentTypeCollection(self.context,
44+
ResourcePathEntity(self.context, self.resourcePath, "contentTypes"))
45+
1946
@property
2047
def items(self):
2148
"""All items contained in the list."""

office365/onedrive/site.py

+40-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
from office365.onedrive.baseItem import BaseItem
2+
from office365.runtime.resource_path_entity import ResourcePathEntity
3+
from office365.onedrive.columnDefinitionCollection import ColumnDefinitionCollection
4+
from office365.onedrive.contentTypeCollection import ContentTypeCollection
25
from office365.onedrive.drive import Drive
6+
from office365.onedrive.driveCollection import DriveCollection
37
from office365.onedrive.listCollection import ListCollection
4-
from office365.runtime.resource_path_entity import ResourcePathEntity
58

69

710
class Site(BaseItem):
811
"""The site resource provides metadata and relationships for a SharePoint site. """
912

13+
@property
14+
def columns(self):
15+
"""The collection of columns under this site."""
16+
if self.is_property_available('columns'):
17+
return self.properties['columns']
18+
else:
19+
return ColumnDefinitionCollection(self.context,
20+
ResourcePathEntity(self.context, self.resourcePath, "columns"))
21+
22+
@property
23+
def contentTypes(self):
24+
"""The collection of content types under this site."""
25+
if self.is_property_available('contentTypes'):
26+
return self.properties['contentTypes']
27+
else:
28+
return ContentTypeCollection(self.context,
29+
ResourcePathEntity(self.context, self.resourcePath, "contentTypes"))
30+
1031
@property
1132
def lists(self):
1233
"""The collection of lists under this site."""
@@ -23,9 +44,27 @@ def drive(self):
2344
else:
2445
return Drive(self.context, ResourcePathEntity(self.context, self.resourcePath, "drive"))
2546

47+
@property
48+
def drives(self):
49+
"""The collection of drives under this site."""
50+
if self.is_property_available('drives'):
51+
return self.properties['drives']
52+
else:
53+
return DriveCollection(self.context, ResourcePathEntity(self.context, self.resourcePath, "drives"))
54+
2655
@property
2756
def sharepointids(self):
2857
"""Returns identifiers useful for SharePoint REST compatibility."""
2958
if self.is_property_available("sharepointIds"):
3059
return self.properties['sharepointIds']
3160
return None
61+
62+
@property
63+
def sites(self):
64+
"""The collection of sites under this site."""
65+
if self.is_property_available('sites'):
66+
return self.properties['sites']
67+
else:
68+
from office365.onedrive.siteCollection import SiteCollection
69+
return SiteCollection(self.context,
70+
ResourcePathEntity(self.context, self.resourcePath, "sites"))

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name="Office365-REST-Python-Client",
13-
version="2.1.5",
13+
version="2.1.6",
1414
author="Vadim Gremyachev",
1515
author_email="vvgrem@gmail.com",
1616
maintainer="Konrad Gądek",

0 commit comments

Comments
 (0)