def resource_path(self): orig_path = ClientObject.resource_path.fget(self) if self.is_property_available( "ServerRelativeUrl") and orig_path is None: return ResourcePathEntry( self.context, self.context.web.resource_path, "GetFolderByServerRelativeUrl('{0}')".format( self.properties["ServerRelativeUrl"])) elif self.is_property_available("UniqueId") and orig_path is None: return ResourcePathEntry( self.context, self.context.web.resource_path, "GetFolderById(guid'{0}')".format(self.properties["UniqueId"])) return orig_path
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.""" contacts = ContactCollection( self.context, ResourcePathEntry(self, self._resource_path, "contacts")) return contacts
def resource_path(self): orig_path = ClientObject.resource_path.fget(self) if self.is_property_available("Id") and orig_path is None: return ResourcePathEntry(self.context, self._parent_collection.resource_path, self.properties["Id"]) return orig_path
def files(self): """Get a file collection""" if self.is_property_available('Files'): return self.properties["Files"] else: return FileCollection( self.context, ResourcePathEntry(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, ResourcePathEntry(self.context, self.resource_path, "RootWeb"))
def lists(self): """Get web list collection""" if self.is_property_available('Lists'): return self.properties['Lists'] else: return ListCollection( self.context, ResourcePathEntry(self.context, self.resource_path, "lists"))
def users(self): """Gets a collection of user objects that represents all of the users in the group.""" if self.is_property_available('Users'): return self.properties['Users'] else: return UserCollection( self.context, ResourcePathEntry(self.context, self.resource_path, "Users"))
def webs(self): """Get child webs""" if self.is_property_available('Webs'): return self.properties['Webs'] else: return WebCollection( self.context, ResourcePathEntry(self.context, self.resource_path, "webs"))
def folders(self): """Get folder resources""" if self.is_property_available('Folders'): return self.properties['Folders'] else: return FolderCollection( self.context, ResourcePathEntry(self.context, self.resource_path, "folders"))
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: return GroupCollection( self.context, ResourcePathEntry(self.context, self.resource_path, "Groups"))
def site_users(self): """Get site users""" if self.is_property_available('SiteUsers'): return self.properties['SiteUsers'] else: return UserCollection( self.context, ResourcePathEntry(self.context, self.resource_path, "siteusers"))
def root_folder(self): """Get a root folder""" if self.is_property_available('RootFolder'): return self.properties["RootFolder"] else: return Folder( self.context, ResourcePathEntry(self.context, self.resource_path, "RootFolder"))
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, ResourcePathEntry(self.context, self.resource_path, "sitegroups"))
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, ResourcePathEntry(self.context, self.resource_path, "ListItemAllFields"))
def current_user(self): """Gets the current user.""" if self.is_property_available('CurrentUser'): return self.properties['CurrentUser'] else: return User( self.context, ResourcePathEntry(self.context, self.resource_path, "CurrentUser"))
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, ResourcePathEntry(self.context, self.resource_path, "listItemAllFields"))
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, ResourcePathEntry(self.context, self.resource_path, "views"))
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, ResourcePathEntry(self.context, self.resource_path, "contenttypes"))
def events(self): """Get an event collection or an event.""" events = EventCollection( self.context, ResourcePathEntry(self, self._resource_path, "events")) return events
def messages(self): """Get an event collection or an event.""" messages = MessageCollection( self.context, ResourcePathEntry(self, self._resource_path, "messages")) return messages
def __init__(self, context, resource_path=None): if resource_path is None: resource_path = ResourcePathEntry(context, None, "Web") super(Web, self).__init__(context, resource_path)
def me(self): """The Me endpoint is provided as a shortcut for specifying the current user by SMTP address.""" return User(self, ResourcePathEntry(self, None, "me"))
def get_by_id(self, contact_id): """Retrieve Contact resource by id""" return Contact( self.context, ResourcePathEntry(self.context, self.resource_path, contact_id))
def __init__(self, context): super(Site, self).__init__(context, ResourcePathEntry(context, None, "Site"))
def get_items(self): """Returns a collection of items from the list based on the specified query.""" items = ListItemCollection( self.context, ResourcePathEntry(self.context, self.resource_path, "items")) return items