+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Get category information of library item

Get category information of library item

5 posts, 0 answered
  1. LouiseBA
    LouiseBA avatar
    61 posts
    Registered:
    23 Mar 2010
    15 Apr 2011
    Link to this post
    Hello I've assigned a category to various image library items in the images and documents module (image library).

    I dont know how to find the items by category. I can't find category in any of the properties of what I get returned as items which have a type of CmsContentBase. I think I have to use GetMetaData("Category") but I cant find a way to convert the item to an IContent item.

    Here is my code:

      Telerik.Libraries.LibraryManager libraryManager = new Telerik.Libraries.LibraryManager();
      IList listOfAllLibraries = libraryManager.GetAllLibraries("Image", true);
     foreach (Telerik.Libraries.ILibrary library in listOfAllLibraries)
       {
        foreach ([what?]  in library.GetItems??)
          {
            if ([what?].Category = "mobile" // dont know what to write here
          }
     {
    add to a collection and do something with it..
    }


    as you can see im a bit lost.

    thanks, louise
  2. LouiseBA
    LouiseBA avatar
    61 posts
    Registered:
    23 Mar 2010
    15 Apr 2011
    Link to this post
    anyone got an answer on this? Im sure is simple, its just that I need to work on it at the weekend. thanks
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Apr 2011
    Link to this post
    Hi LouiseBA,

    Use GetMetaData("Category"), then you can use GetCategory method of the content manager.

    All the best,
    Ivan Dimitrov
    the Telerik team

  4. Justin
    Justin avatar
    5 posts
    Registered:
    30 Sep 2011
    23 Mar 2012
    Link to this post
    What namespace are GetMetaData and GetCategory in?
  5. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    26 Mar 2012
    Link to this post
    Hi,

    GetMetaData and GetCategory can be found in the  Telerik.Cms.Engine namespace.

    Kind regards,

    Atanas Valchev
    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
Register for webinar
5 posts, 0 answered