def ensure_site_assets_library(self): """Gets a list that is the default asset location for images or other files, which the users upload to their wiki pages.""" list_site_assets = List(self.context) qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "ensuresiteassetslibrary") self.context.add_query(qry, list_site_assets) return list_site_assets
def publish(self, comment): """Submits the file for content approval with the specified comment.""" qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "publish", { "comment": comment, }) self.context.add_query(qry)
def unpublish(self, comment): """Removes the file from content approval or unpublish a major version.""" qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "unpublish", { "comment": comment, }) self.context.add_query(qry)
def ensure_site_pages_library(self): """Gets a list that is the default location for wiki pages.""" list_site_pages = List(self.context) qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "ensuresitepageslibrary") self.context.add_query(qry, list_site_pages) return list_site_pages
def moveto(self, new_relative_url, flag): """Moves the file to the specified destination URL.""" qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "moveto", { "newurl": new_relative_url, "flags": flag }, None) self.context.add_query(qry)
def recycle(self): """Moves the file to the Recycle Bin and returns the identifier of the new Recycle Bin item.""" qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "recycle", ) self.context.add_query(qry)
def undocheckout(self): """Reverts an existing checkout for the file.""" qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "undocheckout", ) self.context.add_query(qry)
def checkout(self): """Checks out the file from a document library based on the check-out type.""" qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "checkout", ) self.context.add_query(qry)
def checkin(self, comment, checkin_type): """Checks the file in to a document library based on the check-in type.""" qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "checkin", { "comment": comment, "checkInType": checkin_type }) self.context.add_query(qry)
def copyto(self, new_relative_url, overwrite): """Copies the file to the destination URL.""" qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "moveto", { "newurl": new_relative_url, "boverwrite": overwrite }, None) self.context.add_query(qry)
def validate_update_listItem(self, form_values, new_document_update): """Validates and sets the values of the specified collection of fields for the list item.""" qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "validateUpdateListItem", None, { "formValues": form_values, "bNewDocumentUpdate": new_document_update, }) self.context.add_query(qry)
def start_upload(self, upload_id, content): """Starts a new chunk upload session and uploads the first fragment.""" qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "startupload", {"uploadID": upload_id}, content) result = ClientResult self.context.add_query(qry, result) return result
def finish_upload(self, upload_id, file_offset, content): """Uploads the last file fragment and commits the file. The current file content is changed when this method completes. """ qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "finishupload", { "uploadID": upload_id, "fileOffset": file_offset, }, content) self.context.add_query(qry, self) return self
def continue_upload(self, upload_id, file_offset, content): """Continues the chunk upload session with an additional fragment. The current file content is not changed.""" qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "continueupload", { "uploadID": upload_id, "fileOffset": file_offset, }, content) result = ClientResult self.context.add_query(qry, result) return result
def add_template_file(self, url_of_file, template_file_type): """Adds a ghosted file to an existing list or document library.""" file_new = File(self.context) qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "addTemplateFile", { "urlOfFile": url_of_file, "templateFileType": template_file_type }) self.context.add_query(qry, file_new) self.add_child(file_new) return file_new
def add(self, file_creation_information): """Creates a File resource""" file_new = File(self.context) qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "add", { "overwrite": file_creation_information.overwrite, "url": file_creation_information.url }, file_creation_information.content) self.context.add_query(qry, file_new) self.add_child(file_new) return file_new
def get_items(self, caml_query=None): """Returns a collection of items from the list based on the specified query.""" items = ListItemCollection( self.context, ResourcePathEntity(self.context, self.resource_path, "items")) if caml_query: qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "GetItems", None, caml_query.payload) self.context.add_query(qry, items) return items
def add(self, attachment_file_information): """Creates an attachment""" if isinstance(attachment_file_information, dict): attachment_file_information = AttachmentfileCreationInformation( attachment_file_information.get('filename'), attachment_file_information.get('content')) file_new = File(self.context) qry = ClientQuery.service_operation_query( self, ActionType.PostMethod, "add", { "filename": attachment_file_information.filename, }, attachment_file_information.content) self.context.add_query(qry, file_new) self.add_child(file_new) return file_new
def approve(self, comment): """Approves the file submitted for content approval with the specified comment.""" qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "approve", {"comment": comment}) self.context.add_query(qry)
def update_overwrite_version(self): """Update the list item.""" qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "updateOverwriteVersion") self.context.add_query(qry)
def ensure_user(self, login_name): user = User(self.context) qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "ensureuser", [login_name]) self.context.add_query(qry, user) return user
def get_item_by_id(self, item_id): """Returns the list item with the specified list item identifier.""" list_item = ListItem(self.context, ClientQuery.service_operation_query(self, ActionType.GetMethod, "getitembyid", [item_id])) return list_item
def remove_by_id(self, group_id): """Removes the group with the specified member ID from the collection.""" qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "removebyid", [group_id]) self.context.add_query(qry)
def system_update(self): """Update the list item.""" qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "systemUpdate") self.context.add_query(qry)
def remove_by_login_name(self, group_name): """Removes the cross-site group with the specified name from the collection.""" qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "removebyloginname", [group_name]) self.context.add_query(qry)
def deny(self, comment): """Denies approval for a file that was submitted for content approval.""" qry = ClientQuery.service_operation_query(self, ActionType.PostMethod, "deny", {"comment": comment}) self.context.add_query(qry)