# MediaSet.MediaId() Method
> Version: _Available or changed with runtime version 1.0._
Gets the unique identifier that is assigned to a MediaSet of a record. The MediaSet is a collection of media objects that are used on the record that can be displayed in the client.
## Syntax
```al
MediaId :=   MediaSet.MediaId()
```
> NOTE
> This method can be invoked using property access syntax.
## Parameters
MediaSet
Type: mediaset-data-type
An instance of the mediaset-data-type data type.
## Return Value
MediaId
Type: ../guid/guid-data-type
The GUID of MediaSet on the record.
## Remarks
When you import media on a table record by using either the mediaset-importfile-method or mediaset-importstream-method, the media is assigned to a MediaSet GUID in the system table 2000000183 Tenant Media Set of the application database. You can use the MediaId method to retrieve the MediaSet GUID. Note that the imported media object is also assigned a GUID. To get the media object's GUID, you can use the ../media/media-mediaid-method.
## Example
This example is gets the GUID of the MediaSet that is used on item No. 1000 in the Item table. The field in the Item table that is used for the MediaSet data type is Picture.
```al
 var
    item: Record Item;
    mediasetId: GUID;
    Text000: Label 'The GUID of the MediaSet is: %1';
begin
    item.Get('1000');
    mediasetId := item.Picture.MediaId;
    Message(Text000, mediasetId);
end;
```
## Related information
mediaset-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/mediaset/mediaset-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/mediaset/mediaset-mediaid-method/
