def checkout(self):
     """Checks out the file from a document library based on the check-out type."""
     qry = ServiceOperationQuery(
         self,
         "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 = ServiceOperationQuery(self, "checkin", {
         "comment": comment,
         "checkInType": checkin_type
     })
     self.context.add_query(qry)
Пример #3
0
 def add_team(self):
     """Create a new team under a group."""
     team = Team(self.context)
     qry = ServiceOperationQuery(self, "team", None, team, None, team)
     self.context.add_query(qry)
     self.context.get_pending_request().beforeExecute += self._construct_create_team_request
     return team
 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 = ServiceOperationQuery(self, "validateUpdateListItem", None, {
         "formValues": form_values,
         "bNewDocumentUpdate": new_document_update,
     })
     self.context.add_query(qry)
 def moveto(self, new_relative_url, flag):
     """Moves the file to the specified destination URL."""
     qry = ServiceOperationQuery(self, "moveto", {
         "newurl": new_relative_url,
         "flags": flag
     }, None)
     self.context.add_query(qry)
Пример #6
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.resourcePath, "items"))
     if caml_query:
         qry = ServiceOperationQuery(self, HttpMethod.Post, "GetItems", None, caml_query)
         self.context.add_query(qry, items)
     return items
 def ensureUser(self, login_name):
     target_user = User(self.context)
     self.siteUsers.add_child(target_user)
     qry = ServiceOperationQuery(self, "ensureuser", [login_name], None,
                                 None, target_user)
     self.context.add_query(qry)
     return target_user
 def add(self, web_creation_information):
     web = Web(self.context)
     qry = ServiceOperationQuery(self, "add", None,
                                 web_creation_information)
     self.context.add_query(qry, web)
     self.add_child(web)
     return web
Пример #9
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 = ServiceOperationQuery(self, "ensuresiteassetslibrary")
     self.context.add_query(qry, list_site_assets)
     return list_site_assets
 def copyto(self, new_relative_url, overwrite):
     """Copies the file to the destination URL."""
     qry = ServiceOperationQuery(self, "copyto", {
         "strNewUrl": new_relative_url,
         "boverwrite": overwrite
     }, None)
     self.context.add_query(qry)
 def create(self, request):
     """Create a modern site"""
     response = SPSiteCreationResponse()
     qry = ServiceOperationQuery(self, "Create", None, request, "request",
                                 response)
     self.context.add_query(qry)
     return response
Пример #12
0
 def start_upload(self, upload_id, content):
     """Starts a new chunk upload session and uploads the first fragment."""
     qry = ServiceOperationQuery(self, HttpMethod.Post, "startupload",
                                 {"uploadID": upload_id}, content)
     result = ClientResult(None)
     self.context.add_query(qry, result)
     return result
Пример #13
0
 def copyto(self, new_relative_url, overwrite):
     """Copies the file to the destination URL."""
     qry = ServiceOperationQuery(self, HttpMethod.Post, "moveto", {
         "newurl": new_relative_url,
         "boverwrite": overwrite
     }, None)
     self.context.add_query(qry)
Пример #14
0
 def move(self):
     """Move a message to a folder. This creates a new copy of the message in the destination folder. """
     qry = ServiceOperationQuery(
         self,
         HttpMethod.Post,
         "move",
     )
     self.context.add_query(qry)
Пример #15
0
 def add_item(self, list_item_creation_information):
     """The recommended way to add a list item is to send a POST request to the ListItemCollection resource endpoint,
      as shown in ListItemCollection request examples."""
     item = ListItem(self.context, None, list_item_creation_information)
     item._parent_collection = self
     qry = ServiceOperationQuery(self, "items", None, item)
     self.context.add_query(qry, item)
     return item
 def add(self, view_creation_information):
     view = View(self.context, None, self._parent_list)
     view._parent_collection = self
     qry = ServiceOperationQuery(self, "Add", None,
                                 view_creation_information, "parameters",
                                 view)
     self.context.add_query(qry)
     return view
 def ensure_site_pages_library(self):
     """Gets a list that is the default location for wiki pages."""
     target_list = List(self.context)
     self.add_child(target_list)
     qry = ServiceOperationQuery(self, "ensuresitepageslibrary", None, None,
                                 None, target_list)
     self.context.add_query(qry)
     return target_list
Пример #18
0
 def add(self, user_id):
     """Add a user to the group."""
     payload = {
         "@odata.id":
         "https://graph.microsoft.com/v1.0/users/{0}".format(user_id)
     }
     qry = ServiceOperationQuery(self, "$ref", None, payload)
     self.context.add_query(qry)
 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."""
     result = ClientResult(None)
     qry = ServiceOperationQuery(self, "continueupload", {
         "uploadID": upload_id,
         "fileOffset": file_offset,
     }, content, None, result)
     self.context.add_query(qry)
     return result
 def get_status(self, url):
     """Get the status of a SharePoint site"""
     response = SPSiteCreationResponse()
     qry = ServiceOperationQuery(self, "Status", None, {'url': url}, None,
                                 response)
     self.context.add_query(qry)
     self.context.get_pending_request(
     ).beforeExecute += self._construct_status_request
     return response
 def get_member_groups(self, security_enabled_only=True):
     """Return all the groups that the specified user, group, or directory object is a member of. This function is
     transitive. """
     result = ClientResult(None)
     payload = {"securityEnabledOnly": security_enabled_only}
     qry = ServiceOperationQuery(self, "getMemberGroups", None, payload,
                                 None, result)
     self.context.add_query(qry)
     return result
Пример #22
0
 def reply(self):
     """Reply to the sender of a message by specifying a comment and using the Reply method. The message is then
     saved in the Sent Items folder. """
     qry = ServiceOperationQuery(
         self,
         HttpMethod.Post,
         "reply",
     )
     self.context.add_query(qry)
 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 = ServiceOperationQuery(self, "finishupload", {
         "uploadID": upload_id,
         "fileOffset": file_offset,
     }, content, None, self)
     self.context.add_query(qry)
     return self
Пример #24
0
 def search(self, query_text):
     """Search the hierarchy of items for items matching a query. You can search within a folder hierarchy,
     a whole drive, or files shared with the current user. """
     qry = ServiceOperationQuery(self, HttpMethod.Get, "search", {
         "q": query_text,
     })
     result = ClientResult(None)
     self.context.add_query(qry, result)
     return result
 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."""
     target_list = List(self.context)
     self.add_child(target_list)
     qry = ServiceOperationQuery(self, "ensuresiteassetslibrary", None,
                                 None, None, target_list)
     self.context.add_query(qry)
     return target_list
 def get_items(self, caml_query=None):
     """Returns a collection of items from the list based on the specified query."""
     self._items = ListItemCollection(
         self.context, ResourcePath("items", self.resourcePath))
     if caml_query:
         qry = ServiceOperationQuery(self, "GetItems", None, caml_query,
                                     "query", self._items)
         self.context.add_query(qry)
     return self._items
Пример #27
0
 def create_upload_session(self, item):
     """Creates a temporary storage location where the bytes of the file will be saved until the complete file is
     uploaded. """
     qry = ServiceOperationQuery(self, HttpMethod.Post,
                                 "createUploadSession", None,
                                 {"item": item})
     result = ClientResult(UploadSession())
     self.context.add_query(qry, result)
     return result
Пример #28
0
 def add_item(self, list_item_creation_information):
     """The recommended way to add a list item is to send a POST request to the ListItemCollection resource endpoint,
      as shown in ListItemCollection request examples.
      :type list_item_creation_information: ListItemCreationInformation"""
     item = ListItem(self.context, None, list_item_creation_information)
     self.items.add_child(item)
     item.ensure_type_name(self)
     qry = ServiceOperationQuery(self, "items", None, item, None, item)
     self.context.add_query(qry)
     return item
 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 = ServiceOperationQuery(self, "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 get_status(self, group_id):
     """Get the status of a SharePoint site"""
     group_site_info = GroupSiteInfo()
     qry = ServiceOperationQuery(self, "GetSiteStatus", None,
                                 {'groupId': group_id}, None,
                                 group_site_info)
     self.context.add_query(qry)
     self.context.get_pending_request(
     ).beforeExecute += self._construct_status_request
     return group_site_info