# IRPCUserGroupsAdmin.AddOrUndeleteUserGroup

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md) > [User groups](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCUserGroupsAdmin/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCUserGroupsAdmin/AddOrUndeleteUserGroup/

Badges: `Administration API / specialized` `admin` `session`

Adds a user group, or brings back a removed group with the same name.

- **Service:** [User groups](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCUserGroupsAdmin/index.md) `MFiles.IRPCUserGroupsAdmin`
- **gRPC method:** `/MFiles.IRPCUserGroupsAdmin/AddOrUndeleteUserGroup`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/add-or-undelete-user-group`
- **Request:** [`AddOrUndeleteUserGroupRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCUserGroupsAdmin/AddOrUndeleteUserGroup/index.md#request)
- **Response:** [`AddOrUndeleteUserGroupResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCUserGroupsAdmin/AddOrUndeleteUserGroup/index.md#response)
- **Book and level:** Administration API, specialized
- **Kind:** admin
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** no
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Requires the vault rights `manage_users` and `license_allows_modifications`.
- If a removed group has the same name, it is restored with its old ID, so permissions that
  refer to it apply again. An existing group with the same name fails with "already exists".
- Fails with "The parameter is incorrect." on servers configured not to refresh the user groups
  list when groups are added through the API.

<a id="request"></a>

## Request: AddOrUndeleteUserGroupRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page. Fields marked (recursive) refer to a type already on their path.

| Field | Type | Description |
|---|---|---|
| `usergroup` | [`UserGroup`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.UserGroup/index.md) | The group. `user_group.id` is ignored. |
| `usergroup.user_group` | [`UserGroupBasic`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.UserGroupBasic/index.md) | The basic data of the group. |
| `usergroup.user_group.id` | `int32` | The ID of the user group. |
| `usergroup.user_group.name` | `string` | The name of the group. |
| `usergroup.user_group.members[]` | repeated `int32` | The IDs of the members of this group (user accounts and/or user groups). |
| `usergroup.user_group.type` | [`UserGroupType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.UserGroupType/index.md) | User group type. Values: `USER_GROUP_TYPE_NORMAL` (0), `USER_GROUP_TYPE_REPOSITORY_USER` (1), `USER_GROUP_TYPE_REPOSITORY_GROUP` (2), `USER_GROUP_TYPE_ANY` (-1). |
| `usergroup.is_external_windows_group` | `bool` | Is group imported from Windows domain. |
| `usergroup.synchronize_memberships` | `bool` | Should memberships of this group be synchronized automatically. |
| `usergroup.license_type_for_new_logins` | [`LicenseType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.LicenseType/index.md) | Type of the license for logins created automatically. Values: `LICENSE_TYPE_NONE` (0), `LICENSE_TYPE_NAMED_USER_LICENSE` (1), `LICENSE_TYPE_CONCURRENT_USER_LICENSE` (2), `LICENSE_TYPE_READ_ONLY_LICENSE` (3), `LICENSE_TYPE_VISITOR_LICENSE` (4). |
| `usergroup.external_group_name` | `string` | The name for external group. Empty if the group is not external. |
| `usergroup.organizational_unit` | `string` | The organizational unit for filtering the AD group searches. Empty if the group is not external. |
| `usergroup.acl` | [`AccessControlList`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AccessControlList/index.md) | Permissions. |
| `usergroup.acl.checked_out_to_user` | `int32` | Specifies the ID of the user who has extended rights because of the checkout operation performed by her. 0 if such user does not exist. |
| `usergroup.acl.is_fully_authoritative` | `bool` | Specifies whether this access control list is set to ignore the secondary permissions that come from the latest checked in version. |
| `usergroup.acl.custom_component` | [`AccessControlListComponent`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AccessControlListComponent/index.md) | Accesses the custom component of this ACL. |
| `usergroup.acl.restrictive_components[]` | repeated [`AccessControlListComponentMapEntry`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AccessControlListComponentMapEntry/index.md) | Accesses the restrictive automatic components of this ACL. |
| `usergroup.acl.secondary_access_control_list` | [`AccessControlList`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AccessControlList/index.md) (recursive) | Secondary ACL used for latest version ACL. Not used for access check if null. |
| `usergroup.acl.additive_components[]` | repeated [`AccessControlListComponentMapEntry`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AccessControlListComponentMapEntry/index.md) | Accesses the additive automatic components of this ACL. |
| `usergroup.aliases` | `string` | Semicolon-separated list of semantic aliases. |
| `usergroup.import_mode` | [`ExternalGroupImportMode`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ExternalGroupImportMode/index.md) | Import mode for external groups. Values: `EXTERNAL_GROUP_IMPORT_MODE_UNDEFINED` (0), `EXTERNAL_GROUP_IMPORT_MODE_DIRECT_USERS` (1), `EXTERNAL_GROUP_IMPORT_MODE_DIRECT_AND_NESTED_USERS` (2). |
| `usergroup.external_repository_name` | `string` | External repository name. unset if this group doesn't represent external repository user information. |
| `usergroup.external_repository_subject_id` | `string` | ID in the external repository. unset if this group doesn't represent external repository user information. |
| `add_memebers_as_imported_users` | `bool` | See [AddUserGroup](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCUserGroupsAdmin/AddUserGroup/index.md); leave false. |

<a id="response"></a>

## Response: AddOrUndeleteUserGroupResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `id` | `int32` | The ID of the new or restored group. |
