예제 #1
0
 def add(self, list_creation_information):
     """Creates a List resource"""
     list_entry = List(self.context)
     qry = ClientQuery.create_entry_query(self, list_creation_information)
     self.context.add_query(qry, list_entry)
     self.add_child(list_entry)
     return list_entry
예제 #2
0
 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
예제 #3
0
 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)
예제 #4
0
 def add_from_json(self, event_creation_information):
     """Creates a Event resource from JSON"""
     event = Event(self.context)
     qry = ClientQuery.create_entry_query(self, event_creation_information)
     self.context.add_query(qry, event)
     self.add_child(event)
     return event
예제 #5
0
 def rename(self, name):
     """Rename a Folder resource"""
     item = self.list_item_all_fields
     item.properties['Title'] = name
     item.properties['FileLeafRef'] = name
     qry = ClientQuery.update_entry_query(item)
     self.context.add_query(qry, self)
예제 #6
0
 def add(self, web_creation_information):
     web = Web(self.context)
     qry = ClientQuery(self.resource_url + "/add", ActionType.PostMethod,
                       web_creation_information)
     self.context.add_query(qry, web)
     self.add_child(web)
     return web
 def add(self):
     """Creates a Contact resource"""
     contact = Contact(self.context)
     qry = ClientQuery.create_entry_query(self, contact)
     self.context.add_query(qry, contact)
     self.add_child(contact)
     return contact
예제 #8
0
 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)
예제 #9
0
 def undocheckout(self):
     """Reverts an existing checkout for the file."""
     qry = ClientQuery.service_operation_query(self,
                                               ActionType.PostMethod,
                                               "undocheckout",
                                               )
     self.context.add_query(qry)
예제 #10
0
 def add(self, group_creation_information):
     """Creates a Group resource"""
     group = Group(self.context)
     qry = ClientQuery(self.resource_url, ActionType.CreateEntity,
                       group_creation_information)
     self.context.add_query(qry, group)
     self.add_child(group)
     return group
 def add_from_json(self, contact_creation_information):
     """Creates a Contact resource from JSON"""
     contact = Contact(self.context)
     qry = ClientQuery.create_entry_query(self,
                                          contact_creation_information)
     self.context.add_query(qry, contact)
     self.add_child(contact)
     return contact
예제 #12
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)
예제 #13
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)
예제 #14
0
 def load(self, client_object, properties_to_retrieve=None):
     """Prepare query"""
     if properties_to_retrieve is None:
         properties_to_retrieve = []
     if properties_to_retrieve:
         select_expr = ",".join(properties_to_retrieve)
         client_object = client_object.select(select_expr)
     qry = ClientQuery(client_object.resource_url, ActionType.ReadEntity)
     self.pending_request.add_query(qry, client_object)
예제 #15
0
 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)
예제 #16
0
 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)
예제 #17
0
 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
예제 #18
0
 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)
예제 #19
0
 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
예제 #20
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)
예제 #21
0
 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)
예제 #22
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
예제 #23
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
예제 #24
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
예제 #25
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
예제 #26
0
 def update(self):
     """Update the list."""
     qry = ClientQuery.update_entry_query(self)
     self.context.add_query(qry)
예제 #27
0
 def delete_object(self):
     """Deletes the list."""
     qry = ClientQuery.delete_entry_query(self)
     self.context.add_query(qry)
예제 #28
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)
예제 #29
0
 def update(self):
     qry = ClientQuery.update_entry_query(self)
     self.context.add_query(qry)
예제 #30
0
 def delete_object(self):
     """The recommended way to delete a view is to send a DELETE request to the View resource endpoint, as shown
     in View request examples."""
     qry = ClientQuery.delete_entry_query(self)
     self.context.add_query(qry)
     self.remove_from_parent_collection()