Plumtree EDK (Enterprise Web Development Kit) 5.4.0 |

# IRole.AddMember Method

Adds a member to a role.

void AddMember(
int memberID,
MemberTypes memberType
);

#### Parameters

memberID
  Id of member to be added to role, can be a portal user, or a portal user group; must be positive
memberType
  Member type of member to be added; cannot be `null`

#### Remarks

Adding a nonexistent member id will succeed until the role has been updated via the `Store` method, whereby the role instance will get refreshed.
Note that adding a single user to a role is NOT the same as adding a group with one or more users to a role. The ID of a user who is added with this method can be retrieved using `GetMemberIDs` with `MemberQueryTypes.AllUsers`. However, for users belonging to a group that is then added to a role, IDs of individual users in the group will NOT be retrievable using `GetMemberIDs` with `MemberQueryTypes.AllUsers`. Instead, `MemberQueryTypes.AllGroups` should be used to retrieve the group ID.

#### Exceptions

Exception Type | Condition
--- | ---
ArgumentException | Member ID is not positive

#### See Also

IRole Interface | Plumtree.Remote.PRC.Collaboration.Security Namespace