How do I query Composite C1 media objects?

106 Views Asked by At

Given I have a Guid pointing to an Image. How can I query that image for it's meta data fields (title, description, etc)? Is there helpers for reading the description of an image?

1

There are 1 best solutions below

4
Carl R On

Something like this works.

        string description = null;
        using (DataConnection connection = new DataConnection())
        {
            var mediaFile = connection
                .Get<IMediaFile>()
                .Where(m => m.Id == pictureId)
                .FirstOrDefault();
            if(null != mediaFile)
            {
                description = mediaFile.Description;
            }
        }