{"title":"MediaSet.Remove(Guid) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/mediaset/mediaset-remove-method/","by":"JOP-AL","license":"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-remove-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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/mediaset/mediaset-remove-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Removes a media object from a MediaSet of a record.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"MediaSet.Remove(Guid) Method","slug":"mediasetremoveguid-method","at":0,"chars":2398},{"level":2,"title":"Syntax","slug":"syntax","at":143,"chars":65},{"level":2,"title":"Parameters","slug":"parameters","at":208,"chars":637},{"level":2,"title":"Return Value","slug":"return-value","at":845,"chars":291},{"level":2,"title":"Remarks","slug":"remarks","at":1136,"chars":134},{"level":2,"title":"Example","slug":"example","at":1270,"chars":992},{"level":2,"title":"Related information","slug":"related-information","at":2262,"chars":136}],"text":"# MediaSet.Remove(Guid) Method\n> Version: _Available or changed with runtime version 1.0._\nRemoves a media object from a MediaSet of a record.\n## Syntax\n```al\n[Result := ]  MediaSet.Remove(MediaId: Guid)\n```\n## Parameters\nMediaSet\nType: mediaset-data-type\nAn instance of the mediaset-data-type data type.\nMediaId\nType: ../guid/guid-data-type\nSpecifies the unique ID that is assigned to the media object that you want to remove from the MediaSet. Existing media objects are stored in the system table 2000000184 Tenant Media of the application database. There are different ways of obtaining the GUID of a media object. You could identify the media object ID by looking in the table. Or programmatically, you can use either the Item function on a MediaSet data type field of a record or the MEDIAID function on Media data type field of a record.\n## Return Value\n*[Optional] Result*\nType: ../boolean/boolean-data-type\ntrue if the object was removed or false if a media object with the given ID was not present in the set. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.\n## Remarks\nThe Remove method disassociates the media object from the MediaSet. It does not delete the media object from the database.\n## Example\nThis example uses the REMOVE method and mediaset-item-method to remove a media object from the MediaSet for record '1000' in the table called TableA. This example assumes the following about TableA:\n It has a MediaSet data type field called Images\n It contains the record number '1000'.\n Record '1000' has at least 1 media object in the MediaSet.\n  ```al\n  var\n     recA: Record TableA;\n     mediasetId: GUID;\n     Text000: Label 'Media %1 was removed from MediaSet %2.';\n     Text001: Label 'The media was not removed from MediaSet %1.';\n  begin\n     // Retrieves the GUID of the first media object (index number 1) in the MediaSet of record 1000 in TableA\n     recA.Get('1000');\n     mediaId := recA.Images.Item(1);\n\n     // Removes the media object from the MediaSet of record 1000\n     if recA.Images.Remove(mediaId) then begin\n         recA.Modify;\n         Message(Text000, mediaId, recA.Images.MediaId);\n     end else begin\n         Message(Text001);\n     end;\n  end;\n  ```\n## Related information\nmediaset-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}