def items(self): """All items contained in the list.""" if self.is_property_available('items'): return self.properties['items'] else: return ListItemCollection( self.context, ResourcePathEntity(self.context, self.resourcePath, "items"))
def fields(self): """Gets a value that specifies the collection of all fields in the list.""" if self.is_property_available('Fields'): return self.properties['Fields'] else: return FieldCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "Fields"))
def lists(self): """Get web list collection""" if self.is_property_available('Lists'): return self.properties['Lists'] else: return ListCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "lists"))
def attachmentFiles(self): """Get attachment files""" if self.is_property_available('AttachmentFiles'): return self.properties["AttachmentFiles"] else: from office365.sharepoint.attachmentfile_collection import AttachmentfileCollection return AttachmentfileCollection(self.context, ResourcePathEntity(self.context, self.resourcePath, "AttachmentFiles"))
def columns(self): """The collection of columns under this site.""" if self.is_property_available('columns'): return self.properties['columns'] else: return ColumnDefinitionCollection( self.context, ResourcePathEntity(self.context, self.resourcePath, "columns"))
def lists(self): """The collection of lists under this site.""" if self.is_property_available('lists'): return self.properties['lists'] else: return ListCollection( self.context, ResourcePathEntity(self.context, self.resourcePath, "lists"))
def drive(self): """The default drive (document library) for this site.""" if self.is_property_available('drive'): return self.properties['drive'] else: return Drive( self.context, ResourcePathEntity(self.context, self.resourcePath, "drive"))
def children(self): """Collection containing Item objects for the immediate children of Item. Only items representing folders have children.""" if self.is_property_available('children'): return self.properties['children'] else: from office365.onedrive.driveItemCollection import DriveItemCollection return DriveItemCollection(self.context, ResourcePathEntity(self.context, self.resourcePath, "children"))
def contacts(self): """Get a contact collection from the default Contacts folder of the signed-in user (.../me/contacts), or from the specified contact folder.""" if self.is_property_available('contacts'): return self.properties['contacts'] else: return ContactCollection( self.context, ResourcePathEntity(self, self._resource_path, "contacts"))
def parent_web(self): """Gets the parent website of the specified website.""" if self.is_property_available('ParentWeb'): return self.properties['ParentWeb'] else: return User( self.context, ResourcePathEntity(self.context, self.resource_path, "ParentWeb"))
def set_property(self, name, value, serializable=True): super(Group, self).set_property(name, value, serializable) # fallback: create a new resource path if self._resource_path is None: if name == "id": self._resource_path = ResourcePathEntity( self.context, self._parent_collection.resourcePath, value)
def content_types(self): """Gets the content types that are associated with the list.""" if self.is_property_available('ContentTypes'): return self.properties['ContentTypes'] else: return ContentTypeCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "contenttypes"))
def root_folder(self): """Get a root folder""" if self.is_property_available('RootFolder'): return self.properties["RootFolder"] else: return Folder( self.context, ResourcePathEntity(self.context, self.resource_path, "RootFolder"))
def groups(self): """Gets a collection of group objects that represents all of the groups for the user.""" if self.is_property_available('Groups'): return self.properties['Groups'] else: from office365.sharepoint.group_collection import GroupCollection return GroupCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "Groups"))
def drive(self): """Only present on document libraries. Allows access to the list as a drive resource with driveItems.""" if self.is_property_available('drive'): return self.properties['drive'] else: from office365.onedrive.drive import Drive return Drive( self.context, ResourcePathEntity(self.context, self.resourcePath, "drive"))
def site_users(self): """Get site users""" if self.is_property_available('SiteUsers'): return self.properties['SiteUsers'] else: return UserCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "siteusers"))
def list_item_all_fields(self): """Specifies the list item field (2) values for the list item corresponding to the folder.""" if self.is_property_available('ListItemAllFields'): return self.properties["ListItemAllFields"] else: return ListItem( self.context, ResourcePathEntity(self.context, self.resource_path, "ListItemAllFields"))
def folder(self): """Get folder""" if self.is_property_available("Folder"): return self.properties["Folder"] else: from office365.sharepoint.folder import Folder return Folder( self.context, ResourcePathEntity(self.context, self.resourcePath, "Folder"))
def files(self): """Get a file collection""" if self.is_property_available('Files'): return self.properties["Files"] else: from office365.sharepoint.file_collection import FileCollection return FileCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "Files"))
def folders(self): """Get folder resources""" if self.is_property_available('Folders'): return self.properties['Folders'] else: return FolderCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "folders"))
def file(self): """Get file""" if self.is_property_available("File"): return self.properties["File"] else: from office365.sharepoint.file import File return File( self.context, ResourcePathEntity(self.context, self.resourcePath, "File"))
def listItem(self): """For drives in SharePoint, the associated document library list item.""" if self.is_property_available('listItem'): return self.properties['listItem'] else: return ListItem( self.context, ResourcePathEntity(self.context, self.resourcePath, "listItem"))
def listitem_allfields(self): """Gets a value that specifies the list item field values for the list item corresponding to the file.""" if self.is_property_available('ListItemAllFields'): return self.properties['ListItemAllFields'] else: return ListItem( self.context, ResourcePathEntity(self.context, self.resource_path, "listItemAllFields"))
def folders(self): """Get a folder collection""" if self.is_property_available('Folders'): return self.properties["Folders"] else: from office365.sharepoint.folder_collection import FolderCollection return FolderCollection( self.context, ResourcePathEntity(self.context, self.resourcePath, "Folders"))
def views(self): """Gets a value that specifies the collection of all public views on the list and personal views of the current user on the list.""" if self.is_property_available('Views'): return self.properties['Views'] else: return ViewCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "views"))
def root_web(self): """Get root web""" if self.is_property_available('RootWeb'): return self.properties['RootWeb'] else: return Web( self.context, ResourcePathEntity(self.context, self.resource_path, "RootWeb"))
def resource_path(self): resource_path = super(List, self).resource_path if resource_path: return resource_path # fallback: create a new resource path if self.is_property_available("Id"): self._resource_path = ResourcePathEntity( self.context, self._parent_collection.resource_path, ODataPathParser.from_method("GetById", [self.properties["Id"]])) elif self.is_property_available("Title"): self._resource_path = ResourcePathEntity( self.context, self._parent_collection.resource_path, ODataPathParser.from_method("GetByTitle", [self.properties["Title"]])) return self._resource_path
def resource_path(self): resource_path = super(BaseItem, self).resource_path if resource_path: return resource_path if self.is_property_available("Id"): return ResourcePathEntity( self.context, self._parent_collection.resource_path, self.properties["Id"])
def users(self): """Gets a collection of user objects that represents all of the users in the group.""" from office365.sharepoint.user_collection import UserCollection if self.is_property_available('Users'): return self.properties['Users'] else: return UserCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "Users"))
def current_user(self): """Gets the current user.""" if self.is_property_available('CurrentUser'): return self.properties['CurrentUser'] else: return User( self.context, ResourcePathEntity(self.context, self.resource_path, "CurrentUser"))