More in this section
Forums / Developing with Sitefinity / Sitefinity apis, get images by category

Sitefinity apis, get images by category

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Mohamed
    Mohamed avatar
    15 posts
    24 Oct 2010
    28 Jul 2011
    Link to this post

    I was wondering if it is applicable to categorize Image Albums ? Of not can I assign a cutsom meta field to an Album ?

    An also, how can I select images by category using the sitefinity apis ?

  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    02 Jan 2018
    01 Aug 2011
    Link to this post
    Hello Mohamed,

    Currently the only way of adding a custom field to an Album is through code - you should use the TryCreateNew() method of the DynamicData facade - for instance:
    App.WorkWith().DynamicData().Type(typeof(PageData)).Field().TryCreateNew("MyPageDataField", typeof(string)).SaveChanges(true);
    where you should specify the proper data type for Albums. Once created the field can be accessed and modified using the GetValue() and SetValue() methods. An example of adding a custom field and accessing its values can be found on this forum thread. Please take a look at this article from our Documentation, I believe you might find it useful, concerning the second part of your question. Programmatically you can get the taxonomy using TypeDescriptior.GetProperties or DataExtension method - GetValue, for example:
    var myImages= App.WorkWith().Images()
    .Where(t => t.Status ==Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
                foreach(var item in myImages)
                    var summary = item.GetValue("Summary");

    If you need any further information, please do not hesitate to let us know.

    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered