Sitefinity apis, get images by category

Posted by Community Admin on 04-Aug-2018 13:00

Sitefinity apis, get images by category

All Replies

Posted by Community Admin on 28-Jul-2011 00:00

Hello,

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 ?

Thanks,

Posted by Community Admin on 01-Aug-2011 00:00

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)
.Get()
.ToList();
  
            foreach(var item in myImages)
            
                var summary = item.GetValue("Summary");
            

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

Regards,
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

This thread is closed