Example 10: Add a user to a room group |
In this example, a new user list(of one or more users) is added to an existing group. The users' email addresses, room id, and the group name are passed in as parameters.
Request
Resource.Workspaces workspaces = apiSession.GetWorkspacesResource(); List<AddMemberToGroupJson> memberList = new List<AddMemberToGroupJson>(); // Loop through the List<String> userAddresses foreach (string currentAddress in userAddresses) { PermittedEntityFromUserJson currentEntity = new PermittedEntityFromUserJson { Address = currentAddress, EntityType = EntityType.USER }; //make a AddMemberToGroupJson for each user AddMemberToGroupJson currentMemberJson = new AddMemberToGroupJson { Entity = currentEntity }; memberList.Add(currentMemberJson); } // Set the group name to be a string and roomId is the integer identifying the room AddMembersToGroupWithGroupJson groupMemberJson = new AddMembersToGroupWithGroupJson { MembersList = memberList, RoomId = roomId, GroupName = groupName }; // Make the call to the Rooms resource and return "success" string result = workspaces.AddMembersToGroupV30(groupMemberJson);