# WOPI operations (IRPCWOPIOperations)

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)

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

Creates the access tokens with which Office for the web (WOPI) opens vault files, and returns the
Office for the web actions that the vault can use.

- **gRPC service:** `MFiles.IRPCWOPIOperations`
- **Book and level:** [Server integration API](https://developer.m-files.com/APIs/gRPC-API/integration/index.md), specialized
- **Methods:** 3
- **Proto file:** [`mfiles/IRPCWOPIOperations.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/IRPCWOPIOperations.proto)

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

## Overview

**For M-Files components only.** M-Files clients call this service with the user's own vault
session to hand a file over to Office for the web. Applications should not call it.

- **Callers:** M-Files Web and M-Files Desktop call
  [CreateWOPIUserSession](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperations/CreateWOPIUserSession/index.md) when the user
  opens a file in Office for the web or starts co-authoring, and
  [GetWOPIDiscoveryData](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperations/GetWOPIDiscoveryData/index.md) to learn which
  file types and actions are available. The M-Files WOPI service (the WOPI host that Office for
  the web talks to) calls
  [CreateContainerAccessToken](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperations/CreateContainerAccessToken/index.md) for
  the Office mobile apps.
- **Tokens:** a token is a Base64 string that holds the vault GUID and 64 random bytes. The server
  stores it with the session ID of the caller, and the anonymous methods of
  [IRPCWOPIOperationsPublic](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/index.md) act in that session. A token
  therefore stops working when the session that created it ends, even before the token itself
  expires.
- **Session and rights:** a vault session; no special vault rights. Access to the object is
  checked when the token is created and again on every file operation made with it.
- On a server where the WOPI service is turned off, `CreateWOPIUserSession` fails with "Not
  implemented." (0x80004001) and `GetWOPIDiscoveryData` returns an empty list.

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

## Methods

| Method | Summary | Facts |
|---|---|---|
| [CreateContainerAccessToken](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperations/CreateContainerAccessToken/index.md) | Creates, or returns the existing, container access token with which the Office mobile apps browse a vault location through the M-Files WOPI service. | `internal: not for applications` `write` `session` |
| [CreateWOPIUserSession](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperations/CreateWOPIUserSession/index.md) | Creates a WOPI user session for one file version and returns its token (or a one-time token that can be exchanged for it). | `internal: not for applications` `write` `session` |
| [GetWOPIDiscoveryData](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperations/GetWOPIDiscoveryData/index.md) | Gets the Office for the web actions (action name and URL) that the vault's WOPI configuration provides. | `internal: not for applications` `read` `session` `idempotent` |
