# IRPCVault.GetMetadataStructureItemIdByGUID

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) > [Vault information](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/index.md)

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

Badges: `Vault API / core` `read` `session or assertion` `idempotent` `returns metadata structure version`

Finds the vault-specific ID of a metadata structure item (object type, property definition,
class, workflow, ...) from its GUID.

- **Service:** [Vault information](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/index.md) `MFiles.IRPCVault`
- **gRPC method:** `/MFiles.IRPCVault/GetMetadataStructureItemIdByGUID`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-metadata-structure-item-id-by-guid`
- **Request:** [`GetMetadataStructureItemIdByGUIDRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetMetadataStructureItemIdByGUID/index.md#request)
- **Response:** [`GetMetadataStructureItemIdByGUIDResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetMetadataStructureItemIdByGUID/index.md#response)
- **Book and level:** Vault API, core
- **Kind:** read
- **Session:** Required: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata).
- **Idempotent:** yes
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

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

## Remarks

Use this to resolve structure items by GUID instead of hard-coding their vault-specific IDs.

Supported `item_type` values: `OBJECT_TYPE`, `VALUE_LIST`, `PROPERTY_DEF`, `OBJECT_CLASS`,
`CLASS_GROUP`, `WORKFLOW`, `STATE`, `STATE_TRANSITION`, `NAMED_ACL`, `USER`, `USER_GROUP` and
`VIEW_DEF` (all prefixed `METADATA_STRUCTURE_ITEM_`). Object types and value lists are one
collection: `OBJECT_TYPE` and `VALUE_LIST` both find either kind.

A GUID that matches nothing of the given type returns `is_found` false and `id` 0. An all-zero or
malformed GUID, and `METADATA_STRUCTURE_ITEM_VALUE_LIST_ITEM`, fail with `E_INVALIDARG`.

The result is cacheable; the response carries the metadata structure version in the
`mfiles-metadata-version-bin` trailer.

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

## Request: GetMetadataStructureItemIdByGUIDRequest

> 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 |
|---|---|---|
| `item_type` | [`MetadataStructureItem`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.MetadataStructureItem/index.md) | The kind of item to look for. The method description lists the supported values. |
| `guid` | `string` | The item's GUID, with or without braces, in any case, for example `{9725854F-4A75-403F-A364-F390A67A0535}`. |

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

## Response: GetMetadataStructureItemIdByGUIDResponse

> 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 |
|---|---|---|
| `is_found` | `bool` | True if an item of `item_type` has this GUID. |
| `id` | `int32` | The item's ID in this vault. 0 when `is_found` is false. |

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

## Related methods

- [GetMetadataStructure](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetMetadataStructure/index.md): Gets the vault's real object types (not value lists), with icons, in one call.
