# Vault extension methods (IRPCVaultExtensionMethods)

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.IRPCVaultExtensionMethods/

Calls vault extension methods: server-side code in the vault that takes a string and returns a
string.

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

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

## Overview

A vault extension method is custom server code that a client calls by name. There are two kinds:

- **Event handler methods**: event handlers of the type VaultExtensionMethod, written in
  VBScript in M-Files Admin or registered by a vault application. They are identified by name
  only. Call them with [RunExtensionMethod](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/RunExtensionMethod/index.md)
  with an all-zero `application_id`, or with
  [ExecuteExtensionMethod](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/ExecuteExtensionMethod/index.md).
- **Application extension methods**: methods of an extension object of a vault application,
  identified by the application GUID, the extension, the instance and the method name. Call
  them with [RunExtensionMethod](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/RunExtensionMethod/index.md) or
  [ExecuteExtensionMethodEx](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/ExecuteExtensionMethodEx/index.md).

Prefer [RunExtensionMethod](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/RunExtensionMethod/index.md): it
covers both kinds and can compress large inputs and outputs. The input and output are free-form
strings; their format is defined by the method. Each call runs in its own
transaction.

[ExecuteAnonymousExtensionMethod](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/ExecuteAnonymousExtensionMethod/index.md)
is for the web server that passes anonymous HTTP requests (webhooks) to a vault application.

Errors: an unknown event handler method fails with "Not found. (<name>)"; an unknown application
extension fails with `The specified application "<extension>" does not exist.`.

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

## Methods

| Method | Summary | Facts |
|---|---|---|
| [ExecuteAnonymousExtensionMethod](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/ExecuteAnonymousExtensionMethod/index.md) | Passes an anonymous HTTP request, such as a webhook call, to a vault application. Used by the M-Files web server. | `write` `no session` `returns metadata structure version` |
| [ExecuteExtensionMethod](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/ExecuteExtensionMethod/index.md) | Runs an event handler method by name. In new code use RunExtensionMethod. | `write` `session` `idempotent` `returns metadata structure version` |
| [ExecuteExtensionMethodEx](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/ExecuteExtensionMethodEx/index.md) | Runs an extension method of a vault application. In new code use RunExtensionMethod. | `write` `session` `returns metadata structure version` |
| [IsExtensionMethodAvailable](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/IsExtensionMethodAvailable/index.md) | Tells whether an event handler method with the given name exists and is active. | `read` `session` `idempotent` `returns metadata structure version` |
| [RunExtensionMethod](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultExtensionMethods/RunExtensionMethod/index.md) | Runs a vault extension method, either an event handler method or an application extension method, with optional compression of the input and output. | `write` `session` `returns metadata structure version` |
