# IRPCVault.GetMetadataStructureItemIdByAlias

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

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

Finds the vault-specific ID of a metadata structure item from one of its aliases.

- **Service:** [Vault information](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/index.md) `MFiles.IRPCVault`
- **gRPC method:** `/MFiles.IRPCVault/GetMetadataStructureItemIdByAlias`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-metadata-structure-item-id-by-alias`
- **Request:** [`GetMetadataStructureItemIdByAliasRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetMetadataStructureItemIdByAlias/index.md#request)
- **Response:** [`GetMetadataStructureItemIdByAliasResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetMetadataStructureItemIdByAlias/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

Aliases are names that the vault administrator gives to structure items so that code can refer
to them, for example `PD.InvoiceNumber`. One item can have several aliases.

Matching ignores case and leading and trailing spaces. When no item, or more than one item, of
the given type has the alias, `id` is -1; for `METADATA_STRUCTURE_ITEM_NAMED_ACL` it is -1000,
because -1 is a valid named ACL ID.

Supported `item_type` values: `OBJECT_TYPE`, `VALUE_LIST`, `PROPERTY_DEF`, `OBJECT_CLASS`,
`WORKFLOW`, `STATE`, `STATE_TRANSITION`, `NAMED_ACL` and `USER_GROUP` (all prefixed
`METADATA_STRUCTURE_ITEM_`). Object types and value lists are one collection: `OBJECT_TYPE` and
`VALUE_LIST` both search both. Other types and an empty alias fail with `E_INVALIDARG`.

To resolve many aliases, fetch them all at once with
[GetAllMetadataStructureItemIdswithAliases](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetAllMetadataStructureItemIdswithAliases/index.md)
and cache the result with the metadata structure version.

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

## Request: GetMetadataStructureItemIdByAliasRequest

> 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. |
| `alias` | `string` | One alias, without the `;` that separates an item's aliases. Case does not matter. |

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

## Response: GetMetadataStructureItemIdByAliasResponse

> 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 |
|---|---|---|
| `id` | `int32` | The item's ID, or -1 (-1000 for named ACLs) if no item or several items of `item_type` have the alias. |

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

## Related methods

- [GetAllMetadataStructureItemIdswithAliases](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetAllMetadataStructureItemIdswithAliases/index.md): Gets all unambiguous alias-to-ID mappings of one kind of metadata structure item, or of all kinds, as typed lists.
- [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.
