# Media.MediaId() Method
> Version: _Available or changed with runtime version 1.0._
Gets the unique identifier of a media object on a record.
## Syntax
```al
MediaId :=   Media.MediaId()
```
> NOTE
> This method can be invoked using property access syntax.
## Parameters
Media
Type: media-data-type
An instance of the media-data-type data type.
## Return Value
MediaId
Type: ../guid/guid-data-type
The GUID of the Media object in the database.
## Remarks
When a media is imported on the Media data type field of table record, the media is given a GUID and stored in the system table 2000000184 Tenant Media of the application database. The GUID is then included in the Media data type field as a reference to the media in the database.
## Example
This example uses the MediaId method to get the GUID of the media object that is used on item number 1 in the a the table named My Items.
The example assumes that the My Items table already exists and has a Media data type field named Image.
```al
 var
    myItemRec: Record "My Items";
    imageID: GUID;
    Text000: Label 'Item %1 has a media object with the following ID: %2';
begin
    myItemRec.Get('1');
    mediaGuid := myItemRec.Image.MediaId;
    Message(Text000, myItemRec."No.", imageID);
end;
```
## Related information
media-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/media/media-mediaid-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/media/media-mediaid-method/
