Exemple #1
0
 def add_from_json(self, message_creation_information):
     """Create a draft of a new message from JSON"""
     contact = Message(self.context)
     qry = CreateEntityQuery(self, message_creation_information)
     self.context.add_query(qry, contact)
     self.add_child(contact)
     return contact
 def add_from_json(self, contact_creation_information):
     """Creates a Contact resource from JSON"""
     contact = Contact(self.context)
     qry = CreateEntityQuery(self, contact_creation_information)
     self.context.add_query(qry, contact)
     self.add_child(contact)
     return contact
Exemple #3
0
 def add(self, list_creation_information):
     """Creates a List resource"""
     target_list = List(self.context)
     self.add_child(target_list)
     qry = CreateEntityQuery(self, list_creation_information, target_list)
     self.context.add_query(qry)
     return target_list
Exemple #4
0
 def add(self, field_creation_information):
     """Adds a field to the field collection."""
     field = Field(self.context)
     qry = CreateEntityQuery(self, field_creation_information)
     self.context.add_query(qry, field)
     self.add_child(field)
     return field
Exemple #5
0
 def add(self, group_creation_information):
     """Creates a Group resource"""
     group = Group(self.context)
     qry = CreateEntityQuery(self, group_creation_information)
     self.context.add_query(qry, group)
     self.add_child(group)
     return group
Exemple #6
0
 def add(self, user_properties):
     """Create a new user."""
     usr = User(self.context)
     qry = CreateEntityQuery(self, user_properties)
     self.context.add_query(qry, usr)
     self.add_child(usr)
     return usr
 def add(self, folder_url):
     folder = Folder(self.context)
     self.add_child(folder)
     folder.set_property("ServerRelativeUrl", folder_url)
     qry = CreateEntityQuery(self, folder, folder)
     self.context.add_query(qry)
     return folder
Exemple #8
0
 def add(self, list_creation_information):
     """Creates a List resource"""
     list_entry = List(self.context)
     qry = CreateEntityQuery(self, list_creation_information)
     self.context.add_query(qry, list_entry)
     self.add_child(list_entry)
     return list_entry
Exemple #9
0
 def add(self, list_creation_information):
     """Creates a Drive list resource"""
     new_list = List(self.context)
     qry = CreateEntityQuery(self, list_creation_information)
     self.context.add_query(qry, new_list)
     self.add_child(new_list)
     return new_list
 def add(self):
     """Creates a Contact resource"""
     contact = Contact(self.context)
     qry = CreateEntityQuery(self, contact)
     self.context.add_query(qry, contact)
     self.add_child(contact)
     return contact
 def add_from_json(self, event_creation_information):
     """Creates a Event resource from JSON"""
     event = Event(self.context)
     self.add_child(event)
     qry = CreateEntityQuery(self, event_creation_information, event)
     self.context.add_query(qry)
     return event
Exemple #12
0
 def add_from_json(self, message_creation_information):
     """Create a draft of a new message from JSON"""
     message = Message(self.context)
     self.add_child(message)
     qry = CreateEntityQuery(self, message_creation_information, message)
     self.context.add_query(qry)
     return message
Exemple #13
0
 def add_user(self, login_name):
     user = User(self.context)
     user._parent_collection = self
     user.set_property('LoginName', login_name)
     qry = CreateEntityQuery(self, user, user)
     self.context.add_query(qry)
     self.add_child(user)
     return user
 def add(self, group_properties):
     """Create a Group resource.  You can create the following types of groups:
     Office 365 group (unified group)
     Security group"""
     grp = Group(self.context)
     self.add_child(grp)
     qry = CreateEntityQuery(self, group_properties, grp)
     self.context.add_query(qry)
     return grp
Exemple #15
0
def _add_sub_folder(new_folder_name, target_folder, parent_folder):
    """Creates sub folder by name

    :type new_folder_name: str
    :type parent_folder: Folder
    """
    new_folder_url = "/".join([parent_folder.properties['ServerRelativeUrl'], new_folder_name])
    target_folder.set_property("ServerRelativeUrl", new_folder_url)
    qry = CreateEntityQuery(parent_folder.folders, target_folder, target_folder)
    parent_folder.context.add_query(qry)
Exemple #16
0
 def add(self, server_relative_url):
     """Adds the folder that is located at the specified URL to the collection.
     :type server_relative_url: str
     """
     folder = Folder(self.context)
     self.add_child(folder)
     folder.set_property("ServerRelativeUrl", server_relative_url)
     qry = CreateEntityQuery(self, folder, folder)
     self.context.add_query(qry)
     return folder
    def add(self, user_properties):
        """Create a new user.

        :type user_properties: UserProfile
        """
        usr = User(self.context)
        qry = CreateEntityQuery(self, user_properties, usr)
        self.context.add_query(qry)
        self.add_child(usr)
        return usr
    def add(self, field_creation_information):
        """Adds a fields to the fields collection.

        :type field_creation_information: FieldCreationInformation
        """
        field = Field.create_field_from_type(
            self.context, field_creation_information.FieldTypeKind)
        self.add_child(field)
        qry = CreateEntityQuery(self, field_creation_information, field)
        self.context.add_query(qry)
        return field
 def create_folder(self, name):
     """Create a new folder or DriveItem in a Drive with a specified parent item or path."""
     drive_item = DriveItem(self.context, None)
     drive_item._parent_collection = self.children
     payload = {
         "name": name,
         "folder": {},
         "@microsoft.graph.conflictBehavior": ConflictBehavior.Rename
     }
     qry = CreateEntityQuery(self.children, payload)
     self.context.add_query(qry, drive_item)
     return drive_item
    def add(self, displayName, description=None):
        """Create a new channel in a Microsoft Team, as specified in the request body.

        :param str description: Optional textual description for the channel.
        :param str displayName: Channel name as it will appear to the user in Microsoft Teams.
        """
        new_channel = Channel(self.context)
        payload = {
            "displayName": displayName,
            "description": description,
        }
        qry = CreateEntityQuery(self, payload, new_channel)
        self.context.add_query(qry)
        return new_channel
    def add(self, contentTypeInfo):
        """Adds a new content type to the collection and returns a reference to the added SP.ContentType.

        :param ContentTypeCreationInformation contentTypeInfo: Specifies properties that is to be used to construct
           the new content type.

        """
        ct = ContentType(self.context)
        self.add_child(ct)
        ct_json = contentTypeInfo.to_json()
        for k, v in ct_json.items():
            if k == "Id":
                ct.set_property(k, {"StringValue": v}, True)
            else:
                ct.set_property(k, v, True)
        qry = CreateEntityQuery(self, ct, ct)
        self.context.add_query(qry)
        return ct
 def _add_sub_folder():
     new_folder_url = "/".join([self.serverRelativeUrl, name])
     new_folder.set_property("ServerRelativeUrl", new_folder_url)
     qry = CreateEntityQuery(self.folders, new_folder, new_folder)
     self.context.add_query(qry)