# IRPCWOPIOperationsPublic.SetLockForWOPI

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/SetLockForWOPI/

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

Sets the WOPI lock string of the file of a WOPI user session.

- **Service:** [WOPI operations (anonymous)](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/index.md) `MFiles.IRPCWOPIOperationsPublic`
- **gRPC method:** `/MFiles.IRPCWOPIOperationsPublic/SetLockForWOPI`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/set-lock-for-wopi`
- **Request:** [`SetLockForWOPIRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/SetLockForWOPI/index.md#request)
- **Response:** [`SetLockForWOPIResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/SetLockForWOPI/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 for the WOPI Lock, RefreshLock
and UnlockAndRelock operations. Applications should not call it.
- The token's user needs read and edit access to the object.

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

## Request: SetLockForWOPIRequest

> 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_key` | `string` | The WOPI user session token. |
| `lock` | `string` | The lock string that Office for the web sent. |

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

## Response: SetLockForWOPIResponse

No fields.
