def set_property(self, name, value, persist_changes=True): super(Principal, self).set_property(name, value, persist_changes) # fallback: create a new resource path if self._resource_path is None: if name == "Id": self._resource_path = ServiceOperationPath( "GetById", [value], self.parent_collection.resource_path) elif name == "LoginName": self._resource_path = ServiceOperationPath( "GetByName", [value], self.parent_collection.resource_path) return self
def set_property(self, name, value, persist_changes=True): super(Folder, self).set_property(name, value, persist_changes) # fallback: create a new resource path if name == "ServerRelativeUrl": self._resource_path = ServiceOperationPath( "getFolderByServerRelativeUrl", [value], ResourcePath("Web")) elif name == "ServerRelativePath": self._resource_path = ServiceOperationPath( "getFolderByServerRelativePath", [value], ResourcePath("Web")) elif name == "UniqueId": self._resource_path = ServiceOperationPath("getFolderById", [value], ResourcePath("Web")) return self
def get_related_fields(self): """Returns a collection of lookup fields that use this list as a data source and that have FieldLookup.IsRelationship set to true. """ return RelatedFieldCollection( self.context, ServiceOperationPath("getRelatedFields", [], self.resource_path))
def get_limited_webpart_manager(self, scope): """Specifies the control set used to access, modify, or add Web Parts associated with this Web Part Page and view. """ return LimitedWebPartManager( self.context, ServiceOperationPath("getlimitedwebpartmanager", [scope], self.resource_path))
def set_property(self, name, value, persist_changes=True): super(ContentType, self).set_property(name, value, persist_changes) # fallback: create a new resource path if name == "StringId" and self._resource_path is None: self._resource_path = ServiceOperationPath( "getById", [value], self._parent_collection.resource_path) return self
def get_by_id(self, node_id): """Gets the navigation node with the specified ID. :type node_id: str """ return NavigationNode(self.context, ServiceOperationPath("GetById", [node_id], self.resource_path))
def get_list(self, url): """Get list by url :type url: str """ return List(self.context, ServiceOperationPath("getList", [url], self.resource_path))
def set_property(self, name, value, persist_changes=True): if self.resource_path is None: if name == "Id": self._resource_path = ServiceOperationPath( "GetById", [value], self._parent_collection.resource_path) return super(RoleDefinition, self).set_property(name, value, persist_changes)
def get_activities_by_interval(self, start_dt=None, end_dt=None, interval=None): """ Get a collection of itemActivityStats resources for the activities that took place on this resource within the specified time interval. :param datetime.datetime start_dt: The start time over which to aggregate activities. :param datetime.datetime end_dt: The end time over which to aggregate activities. :param str interval: The aggregation interval. """ params = { "startDateTime": start_dt.strftime('%m-%d-%Y') if start_dt else None, "endDateTime": end_dt.strftime('%m-%d-%Y') if end_dt else None, "interval": interval } return_type = EntityCollection( self.context, ItemActivityStat, ServiceOperationPath("getActivitiesByInterval", params, self.resource_path)) qry = ServiceOperationQuery(self, "getActivitiesByInterval", params, None, None, return_type) self.context.add_query(qry) def _construct_request(request): request.method = HttpMethod.Get self.context.before_execute(_construct_request) return return_type
def __init__(self, context, account_name, property_names): params = {"accountName": account_name, "propertyNames": property_names} super(UserProfilePropertiesForUser, self).__init__( context, ServiceOperationPath( "SP.UserProfiles.UserProfilePropertiesForUser", params))
def set_property(self, name, value, persist_changes=True): if persist_changes: if isinstance(value, TaxonomyFieldValueCollection): self._set_taxonomy_field_value(name, value) elif isinstance(value, FieldMultiLookupValue): collection = ClientValueCollection(int, [v.LookupId for v in value]) super(ListItem, self).set_property("{name}Id".format(name=name), collection) super(ListItem, self).set_property(name, value, False) elif isinstance(value, FieldLookupValue): super(ListItem, self).set_property("{name}Id".format(name=name), value.LookupId) super(ListItem, self).set_property(name, value, False) else: super(ListItem, self).set_property(name, value, persist_changes) else: super(ListItem, self).set_property(name, value, persist_changes) # fallback: create a new resource path if self._resource_path is None: if name == "Id" and self._parent_collection is not None: self._resource_path = ServiceOperationPath( "getItemById", [value], self._parent_collection.resource_path.parent) return self
def set_property(self, name, value, persist_changes=True): if self._resource_path is None: if name == "Id" and self._parent_collection is not None: self._resource_path = ServiceOperationPath( "getById", [value], self.parent_collection.resource_path) return super(SitePageMetadata, self).set_property(name, value, persist_changes)
def set_property(self, name, value, persist_changes=True): super(AttachmentFile, self).set_property(name, value, persist_changes) # fallback: create a new resource path if name == "ServerRelativeUrl": self._resource_path = ServiceOperationPath( "getFileByServerRelativeUrl", [value], ResourcePath("Web"))
def set_property(self, name, value, persist_changes=True): super(RecycleBinItem, self).set_property(name, value, persist_changes) # fallback: create a new resource path if self._resource_path is None: if name == "Id" and self._parent_collection is not None: self._resource_path = ServiceOperationPath( "GetById", [value], self._parent_collection.resource_path)
def set_property(self, name, value, persist_changes=True): super(ListTemplate, self).set_property(name, value, persist_changes) if self._resource_path is None: if name == "Name": self._resource_path = ServiceOperationPath( "GetByName", [value], self._parent_collection.resource_path) return self
def get_item_by_id(self, item_id): """Returns the list item with the specified list item identifier. :type item_id: int """ return ListItem( self.context, ServiceOperationPath("getItemById", [item_id], self.resource_path))
def get_by_id(self, group_id): """Returns the list item with the specified list item identifier. :type group_id: str """ return Group( self.context, ServiceOperationPath("GetById", [group_id], self.resource_path))
def get_by_type(self, role_type): """Returns role definition of the specified type from the collection. :param int role_type: Specifies the role type. Role type MUST NOT be None. """ return RoleDefinition( self.context, ServiceOperationPath("GetByType", [role_type], self.resource_path))
def get_by_id(self, _id): """Retrieve Hub site by id :type _id: str """ return HubSite( self.context, ServiceOperationPath("GetById", [_id], self.resource_path))
def get_user_by_id(self, user_id): """Returns the user corresponding to the specified member identifier for the current site. :param int user_id: Specifies the member identifier. """ return User( self.context, ServiceOperationPath("getUserById", [user_id], self.resource_path))
def set_property(self, name, value, persist_changes=True): # fallback: create a new resource path if self._resource_path is None: if name == "id": self._resource_path = ServiceOperationPath( "getById", [value], self._parent_collection.resource_path) return super(Subscription, self).set_property(name, value, persist_changes)
def get_by_name(self, name): """ :param str name: :return: """ return ListTemplate(self.context, ServiceOperationPath("getByName", [name], self.resource_path))
def get_by_title(self, title): """Returns the first fields object in the collection based on the title of the specified fields. :type title: str """ return Field( self.context, ServiceOperationPath("getByTitle", [title], self.resource_path))
def get_catalog(self, type_catalog): """ Specifies the list template gallery, site template gallery, Web Part gallery, master page gallery, or other galleries from the site collection, including custom galleries that are defined by users. :type type_catalog: int """ return List(self.context, ServiceOperationPath("getCatalog", [type_catalog], self.resource_path))
def get_folder_by_server_relative_url(self, url): """Returns the folder object located at the specified server-relative URL. :type url: str """ return Folder( self.context, ServiceOperationPath("getFolderByServerRelativeUrl", [url], self.resource_path))
def get_by_id(self, list_id): """Retrieve List client object by id :type list_id: str """ return List( self.context, ServiceOperationPath("GetById", [list_id], self.resource_path))
def get_by_email(self, email): """Retrieve User object by email :type email: str """ return User( self.context, ServiceOperationPath("GetByEmail", [email], self.resource_path))
def get_by_login_name(self, login_name): """Retrieve User object by login name :type login_name: str """ return User( self.context, ServiceOperationPath("GetByLoginName", [login_name], self.resource_path))
def get_by_id(self, _id): """Returns an SP.WebInformation (section 3.2.5.192) object that contains metadata about a site (2) specified by the identifier of the site :param str _id: Specifies the identifier of site """ return WebInformation( self.context, ServiceOperationPath("GetById", [_id], self.resource_path))
def get_view(self, view_id): """Returns the list view with the specified view identifier. :type view_id: str """ return View( self.context, ServiceOperationPath("getView", [view_id], self.resource_path), self)