# IRPCWOPIOperationsPublic.GetWOPIUserSession

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Server integration API](https://developer.m-files.com/APIs/gRPC-API/integration/index.md) > [WOPI operations (anonymous)](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/index.md)

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

Badges: `Server integration API / specialized` `internal: not for applications` `write` `no session`

Gets the details of a WOPI user session: the shared object and file version, the action, the
user and whether editing is allowed.

- **Service:** [WOPI operations (anonymous)](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/index.md) `MFiles.IRPCWOPIOperationsPublic`
- **gRPC method:** `/MFiles.IRPCWOPIOperationsPublic/GetWOPIUserSession`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-wopiuser-session`
- **Request:** [`GetWOPIUserSessionRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/GetWOPIUserSession/index.md#request)
- **Response:** [`GetWOPIUserSessionResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/GetWOPIUserSession/index.md#response)
- **Book and level:** Server integration API, specialized
- **Kind:** write
- **Session:** Not needed: the call can be made before logging in.
- **Idempotent:** no
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

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

## Remarks

**For M-Files components only.** The M-Files WOPI service calls it to validate each request from
Office for the web, and M-Files Web calls it when it opens the editor page. Applications should
not call it.
- Extends the expiration of the WOPI user session to 30 minutes (the default) from now.
- With a container access token (`type` `WOPITOKEN_TYPE_WOPICONTAINER_TOKEN`) and `objid` and
  `file_id`, it finds or creates a WOPI user session for that file; creating one checks the object
  out to the token's user and fails if the object is checked out to another user or computer.

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

## Request: GetWOPIUserSessionRequest

> 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 |
|---|---|---|
| `pwszkey` | `string` | The token, of the kind that `type` names. |
| `type` | [`WOPITokenType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.WOPITokenType/index.md) | `WOPITOKEN_TYPE_WOPIVAULT_USER_SESSION_TOKEN` (the default) or `WOPITOKEN_TYPE_WOPICONTAINER_TOKEN`. Values: `WOPITOKEN_TYPE_WOPIVAULT_USER_SESSION_TOKEN` (0), `WOPITOKEN_TYPE_ONE_TIME_TOKEN` (1), `WOPITOKEN_TYPE_WOPICONTAINER_TOKEN` (2). |
| `objid` | [`ObjID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjID/index.md) | The object; used only with a container access token. |
| `objid.type` | `int32` | The object type ID, for example 0 for documents. In a lookup value, the value list ID (for a lookup to objects, the object type ID). |
| `objid.item_id` | [`ItemID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ItemID/index.md) | The ID of the object within its type, in `item_id.internal_id`. |
| `objid.item_id.internal_id` | `int32` | The ID of the object or value list item. |
| `objid.item_id.external_repository_id` | [`ExternalRepositoryID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ExternalRepositoryID/index.md) | Used only for objects in external repositories (external connectors). Leave it unset for objects stored in the vault. |
| `file_id` | `int32` | The file ID; used only with a container access token. |

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

## Response: GetWOPIUserSessionResponse

> 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 |
|---|---|---|
| `wopi_user_session` | [`WOPIUserSession`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.WOPIUserSession/index.md) | The session. `is_edit_allowed` is false when the user's license is read-only, the user lacks edit access, the object is deleted or has no editable files, an older version is shared, or the object is checked out to someone else (except in co-authoring). `is_coauthor` is true for the user who started co-authoring; `is_shared_file` for the other co-authors. |
| `wopi_user_session.wopi_user_session_key` | `string` | The WOPI vault user session key. |
| `wopi_user_session.wopi_accesskey` | `string` | The access of the shared file. |
| `wopi_user_session.action_type` | [`WOPIActionType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.WOPIActionType/index.md) | The WOPI Action type. Values: `WOPIACTION_TYPE_VIEW` (0), `WOPIACTION_TYPE_EDIT` (1), `WOPIACTION_TYPE_COAUTHORING` (2). |
| `wopi_user_session.user_account_id` | `uint32` | The user ID. |
| `wopi_user_session.user_account_name` | `string` | The user Account Name. |
| `wopi_user_session.external_username` | `string` | The External user name. |
| `wopi_user_session.additional_data` | [`WOPIClientAdditionalData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.WOPIClientAdditionalData/index.md) | WOPI Client Additional data. |
| `wopi_user_session.additional_data.return_uri` | `string` | The Return URL. |
| `wopi_user_session.additional_data.main_app_url` | `string` | The Main Appp URL. |
| `wopi_user_session.additional_data.wopi_end_point` | `string` | The WOPI Endpoint. |
| `wopi_user_session.additional_data.culture_identifier` | `string` | The Culture identifier. |
| `wopi_user_session.additional_data.action_url` | `string` | The action URL. |
| `wopi_user_session.additional_data.host_edit_url` | `string` | The Host edit URL. |
| `wopi_user_session.obj_ver` | [`ObjVer`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjVer/index.md) | The ObjVer of the object. |
| `wopi_user_session.obj_ver.obj_id` | [`ObjID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjID/index.md) | The object. |
| `wopi_user_session.obj_ver.version` | [`ObjVerVersion`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjVerVersion/index.md) | The version. Usually `OBJ_VER_VERSION_TYPE_SPECIFIC` with `internal_version`. |
| `wopi_user_session.file_ver` | [`FileVer`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.FileVer/index.md) | The FileVer of the object. |
| `wopi_user_session.file_ver.file_id` | [`FileID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.FileID/index.md) | The file. |
| `wopi_user_session.file_ver.type` | [`FileVerType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.FileVerType/index.md) | `FILE_VER_TYPE_SPECIFIC` for a file version number. Values: `FILE_VER_TYPE_UNINITIALIZED` (0), `FILE_VER_TYPE_LATEST` (1), `FILE_VER_TYPE_ANY` (2), `FILE_VER_TYPE_SPECIFIC` (3). |
| `wopi_user_session.file_ver.internal_version` | `int32` | The file version number. |
| `wopi_user_session.file_ver.external_repository_version` | `string` | Used only for files in external repositories. Leave empty. |
| `wopi_user_session.file_ver.external_repository_sort_key` | `int64` | Used only for files in external repositories. Leave 0. |
| `wopi_user_session.is_shared_file` | `bool` | Specifies the Shared file. |
| `wopi_user_session.is_coauthor` | `bool` | Specifies the Co-authored file. |
| `wopi_user_session.csrftoken` | `string` | The CSRF Token. |
| `wopi_user_session.onetimetoken` | `string` | The One Time Token. |
| `wopi_user_session.is_edit_allowed` | `bool` | Specifies whether the file can be edited or not. |
| `wopi_user_session.client_type` | [`ClientType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ClientType/index.md) | The client type (user agent) identifier. |

<a id="related"></a>

## Related methods

- [GetWOPIUserSessionKey](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/GetWOPIUserSessionKey/index.md): Exchanges a one-time token for the WOPI user session token it stands for.
