Smartsheet.Api.Internal.GroupResourcesImpl.CreateGroup C# (CSharp) Method

CreateGroup() public method

Creates a new Group.

It mirrors To the following Smartsheet REST API method: POST /groups

This operation is only available to group administrators and system administrators.
if any argument is null or empty string if there is any problem with the REST API request if there is any problem with the REST API authorization (access token) if the resource cannot be found if the REST API service is not available (possibly due To rate limiting) if there is any other error during the operation
public CreateGroup ( Group group ) : Group
group Group the group object
return Group
        public virtual Group CreateGroup(Group group)
        {
            return this.CreateResource<Group>("groups", typeof(Group), group);
        }

Usage Example

        public virtual void TestCreateGroup()
        {
            server.setResponseBody("../../../TestSDK/resources/createGroup.json");

            GroupMember newMember = new GroupMember.AddGroupMemberBuilder("*****@*****.**").Build();

            GroupMember[] members  = new GroupMember[] { newMember };
            Group         newGroup = new Group.CreateGroupBuilder("API-created Group", "Group created via API").SetMembers(members).Build();

            Group createdGroup = groupResources.CreateGroup(newGroup);

            Assert.AreEqual(newGroup.Name, createdGroup.Name);
            Assert.AreEqual(newGroup.Description, createdGroup.Description);
            Assert.AreEqual(newGroup.Members[0].Email, createdGroup.Members[0].Email);
            Assert.AreEqual(4583173393803140, createdGroup.Members[0].Id);
        }