Developer forum

Forum » Development » File meta data thru api

File meta data thru api

Remi Muller
Reply

I have product detail razor template.

Is it possible to read the file meta data through the DW api?

Templatetags is not exposing the meta data fields for "Details - Images/Links" for a product.


Replies

 
Mikkel Ricky
Reply

You can get the metadata for a file like this:

@{
    var file = "Files/Images/animals/image0.jpg";
    var metadata = Dynamicweb.Content.Files.Metadata.EditorFactory.GetMetadataForFile(file);
    if (metadata != null)
    {
        // Use metadata.GetValue(...), e.g.
        <pre>@metadata.GetValue("caption")</pre>
    }
}

Best regards,
Mikkel

 

You must be logged in to post in the forum