def resource_path(self): resource_path = super(Attachmentfile, self).resource_path if resource_path: return resource_path # fallback: create a new resource path if self.is_property_available("ServerRelativeUrl"): self._resource_path = ResourcePathEntity( self.context, ResourcePathEntity(self.context, None, "Web"), ODataPathParser.from_method( "GetFileByServerRelativeUrl", [self.properties["ServerRelativeUrl"]])) return self._resource_path
def users(self): """Gets a collection of user objects that represents all of the users in the group.""" from spoklient.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 file(self): """Get file""" if self.is_property_available("File"): return self.properties["File"] else: from spoklient.sharepoint.file import File return File(self.context, ResourcePathEntity(self.context, self.resource_path, "File"))
def resource_path(self): resource_path = super(Principal, 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("LoginName"): self._resource_path = ResourcePathEntity( self.context, self._parent_collection.resource_path, ODataPathParser.from_method("GetByName", [self.properties["LoginName"]]))
def folder(self): """Get folder""" if self.is_property_available("Folder"): return self.properties["Folder"] else: from spoklient.sharepoint.folder import Folder return Folder(self.context, ResourcePathEntity(self.context, self.resource_path, "Folder"))
def root(self): """The root folder of the drive.""" if self.is_property_available("root"): return self.properties['root'] else: return DriveItem( self.context, ResourcePathEntity(self.context, self.resource_path, "root"))
def view_fields(self): if self.is_property_available('ViewFields'): return self.properties['ViewFields'] else: return ViewFieldCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "ViewFields"))
def attachment_files(self): """Get attachment files""" if self.is_property_available('AttachmentFiles'): return self.properties["AttachmentFiles"] else: from spoklient.sharepoint.attachmentfile_collection import AttachmentfileCollection return AttachmentfileCollection(self.context, ResourcePathEntity(self.context, self.resource_path, "AttachmentFiles"))
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 files(self): """Get a file collection""" if self.is_property_available('Files'): return self.properties["Files"] else: from spoklient.sharepoint.file_collection import FileCollection return FileCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "Files"))
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 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 spoklient.sharepoint.group_collection import GroupCollection return GroupCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "Groups"))
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 resource_path(self): resource_path = super(OutlookEntity, self).resource_path if resource_path: return resource_path # fallback: create a new resource path if self.is_property_available("Id"): return ResourcePathEntity(self.context, self._parent_collection.resource_path, self.properties["Id"])
def folders(self): """Get a folder collection""" if self.is_property_available('Folders'): return self.properties["Folders"] else: from spoklient.sharepoint.folder_collection import FolderCollection return FolderCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "Folders"))
def resource_path(self): resource_path = super(Folder, self).resource_path if resource_path: return resource_path # fallback: create a new resource path if self.is_property_available("ServerRelativeUrl"): self._resource_path = ResourcePathEntity( self.context, ResourcePathEntity.from_uri("Web", self.context), ODataPathParser.from_method( "GetFolderByServerRelativeUrl", [self.properties["ServerRelativeUrl"]])) elif self.is_property_available("UniqueId"): self._resource_path = ResourcePathEntity( self.context, ResourcePathEntity.from_uri("Web", self.context), ODataPathParser.from_method( "GetFolderById", [{ 'guid': self.properties["UniqueId"] }])) return self._resource_path
def webs(self): """Get child webs""" if self.is_property_available('Webs'): return self.properties['Webs'] else: from spoklient.sharepoint.web_collection import WebCollection parent_web_url = None if self.is_property_available('Url'): parent_web_url = self.properties['Url'] return WebCollection(self.context, ResourcePathEntity(self.context, self.resource_path, "webs"), parent_web_url)
def resource_path(self): resource_path = super(ListItem, 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("getItemById", [self.properties["Id"]])) return self._resource_path
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 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 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 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 site_groups(self): """Gets the collection of groups for the site collection.""" if self.is_property_available('SiteGroups'): return self.properties['SiteGroups'] else: return GroupCollection(self.context, ResourcePathEntity(self.context, self.resource_path, "sitegroups"))
def __init__(self, context): super(Site, self).__init__(context, ResourcePathEntity(context, None, "Site"))
def get_by_id(self, contact_id): """Retrieve Contact resource by id""" return Contact( self.context, ResourcePathEntity(self.context, self.resource_path, contact_id))
def get_by_id(self, drive_id): """Retrieve Drive by unique identifier""" return Drive( self.context, ResourcePathEntity(self.context, self.resource_path, drive_id))
def me(self): """The Me endpoint is provided as a shortcut for specifying the current user by SMTP address.""" return User(self, ResourcePathEntity(self, None, "me"))
def item_with_path(self, path): """Retrieve DriveItem by path""" return DriveItem( self.context, ResourcePathEntity(self.context, self.resource_path, ':/{0}'.format(path)))
def drives(self): """Get one drives""" return DriveCollection(self, ResourcePathEntity(self, None, "drives"))
def __init__(self, context, resource_path=None): if resource_path is None: resource_path = ResourcePathEntity(context, None, "Web") super(Web, self).__init__(context, resource_path) self._web_path = None