# Substitute users (IRPCSubstituteUsers)

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md)

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

Reads and sets the substitute users of users.

- **gRPC service:** `MFiles.IRPCSubstituteUsers`
- **Book and level:** [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md), standard
- **Methods:** 4
- **Proto file:** [`mfiles/IRPCSubstituteUsers.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/IRPCSubstituteUsers.proto)

<a id="overview"></a>

## Overview

Reads and sets substitute users: users or user groups who act for a user, for example during an
absence. A substitute sees the assignments of the users they substitute for in views that use
the "current user and substituted users" pseudo user, such as the built-in Assigned to Me view.

- **The caller's own substitutes**:
  [GetSubstituteUsers](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/GetSubstituteUsers/index.md) and
  [SetSubstituteUsers](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/SetSubstituteUsers/index.md). Any user can
  manage their own list.
- **Any user's substitutes, and the reverse lookup** (administration):
  [GetSubstituteUsersOfUser](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/GetSubstituteUsersOfUser/index.md) and
  [GetUsersBySubstituteUser](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/GetUsersBySubstituteUser/index.md). These
  need the vault right `manage_users`.

The session's own view of substitution is in the login response:
`SessionData.vault_data.substitute_users` lists the session's user followed by the users that
this user currently substitutes for.

Substitution can be turned off for the whole server. Then the get methods return empty lists and
[SetSubstituteUsers](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/SetSubstituteUsers/index.md) fails with "Access
denied.".

<a id="methods"></a>

## Methods

| Method | Summary | Facts |
|---|---|---|
| [GetSubstituteUsers](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/GetSubstituteUsers/index.md) | Gets the substitutes of the calling user. | `read` `session` `idempotent` `returns metadata structure version` |
| [GetSubstituteUsersOfUser](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/GetSubstituteUsersOfUser/index.md) | Gets the substitutes of any user (administration). | `read` `session` `idempotent` `returns metadata structure version` |
| [GetUsersBySubstituteUser](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/GetUsersBySubstituteUser/index.md) | Gets the users for whom a given user is a substitute, directly or through group membership (administration). | `read` `session` `idempotent` `returns metadata structure version` |
| [SetSubstituteUsers](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/SetSubstituteUsers/index.md) | Replaces the substitutes of the calling user. | `write` `session` `idempotent` `returns metadata structure version` |
