{"title":"MediaSet.Count() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/mediaset/mediaset-count-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-count-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-count-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":"Gets the number of media objects that are included in the MediaSet of a record.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":140,"chars":114},{"level":2,"title":"Parameters","slug":"parameters","at":254,"chars":97},{"level":2,"title":"Return Value","slug":"return-value","at":351,"chars":132},{"level":2,"title":"Example","slug":"example","at":483,"chars":471},{"level":2,"title":"Related information","slug":"related-information","at":954,"chars":136}],"text":"> Version: _Available or changed with runtime version 1.0._\nGets the number of media objects that are included in the MediaSet of a record.\n## Syntax\n```al\nCount :=   MediaSet.Count()\n```\n> NOTE\n> This method can be invoked using property access syntax.\n## Parameters\nMediaSet\nType: mediaset-data-type\nAn instance of the mediaset-data-type data type.\n## Return Value\nCount\nType: ../integer/integer-data-type\nThe number of media objects that are included in the MediaSet of a record.\n## Example\nThis example counts the number of media objects that are available for item No. 1000 in table 27 Item of the CRONUS demonstration database. In this example, the field in the Item table that is used for the MediaSet data type is Picture.\n```al\n var\n    itemRec: Record Item;\n    count: Integer;\n    Text000: Label 'The number of media files: %1';\nbegin\n    itemRec.Get('1000');\n        count := (itemRec.Picture.Count);\n        Message(Text000,count);\nend;\n```\n## Related information\nmediaset-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}