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)
Ejemplo n.º 10
0
 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)
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
 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
Ejemplo n.º 13
0
 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
Ejemplo n.º 14
0
 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
Ejemplo n.º 17
0
 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
Ejemplo n.º 18
0
    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
Ejemplo n.º 19
0
 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)
Ejemplo n.º 20
0
 def update_overwrite_version(self):
     """Update the list item."""
     qry = ClientQuery.service_operation_query(self, ActionType.PostMethod,
                                               "updateOverwriteVersion")
     self.context.add_query(qry)
Ejemplo n.º 21
0
 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
Ejemplo n.º 22
0
 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
Ejemplo n.º 23
0
 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)
Ejemplo n.º 24
0
 def system_update(self):
     """Update the list item."""
     qry = ClientQuery.service_operation_query(self, ActionType.PostMethod,
                                               "systemUpdate")
     self.context.add_query(qry)
Ejemplo n.º 25
0
 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)
Ejemplo n.º 26
0
 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)