More in this section

Forums / Developing with Sitefinity / Retrieve all MetaData for a particular Library

Retrieve all MetaData for a particular Library

2 posts, 0 answered
  1. Scott Harrington
    Scott Harrington avatar
    28 posts
    Registered:
    21 Sep 2009
    14 Oct 2009
    Link to this post
    Hello,

    I am having some issue's retrieving all items in the GCMetaData table by CntPrntID.  I am trying to pull all the data details for all items in a video library.

    Here's a code snippet:

    //Get's all Video Library Guids 
    LibraryManager libraryManager = new LibraryManager(); 
    IList listOfAllLibraries = libraryManager.GetAllLibraries(); 
    List<Guid> videoLibraries = new List<Guid>(); 
     
    if (listOfAllLibraries.Count > 0) 
            foreach (ILibrary item in listOfAllLibraries) 
            { 
                if (item.TypeName == "Video"
                    { 
                        videoLibraries.Add(item.ID); 
                    } 
            } 

    So I end up with two Guids as I have two video libraries.  Now my goal would be to pull the following items from the GCMetaData Table.  I've tried building a list of IMetaSearchInfo and pass the array to my MangerContent Object but I was getting an error.  My filter is the problem as I am trying to filter by a Column not KeyValue Key.  Here's the code:

    1   ContentManager cntManager = new ContentManager("Libraries"); 
    2   List<IMetaSearchInfo> filter = new List<IMetaSearchInfo>(); 
    3  
    4   foreach (Guid item in videoLibraries) 
    5   { 
    6       filter.Add(new MetaSearchInfo(MetaValueTypes.Guid, "CntPrntID", item)); 
    7   } 
    8    
    9   IList listOfContentItems = cntManager.GetMetaData(filter.ToArray()); 

    Line 9 fails because it's confused by my filter.  Could I get a little assistance on pulling all items from the the GCMetaData table filtering by multiple 'CntPrntID' values.  Thank you so much for your help!!!


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    14 Oct 2009
    Link to this post
    Hello Scott Harrington,

    It is not possible to filer metakeys for a library, since the metakeys are for a provider (manager.Provider.MetaKeys.Values). Also in MetaSerchInfor filter you cannot pass the content parent ID, you can use only metakeys. Content Parent ID is the ID  of a library which has content items. You can get all content items from a given library and then extract the metadata.

    I hope this clears the situation.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered