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

Forums / Developing with Sitefinity / Problems with GetContent(Int32,Int32,IMetaSearchInfo[],Guid[]) Method

Problems with GetContent(Int32,Int32,IMetaSearchInfo[],Guid[]) Method

2 posts, 1 answered
  1. Keith
    Keith avatar
    67 posts
    Registered:
    13 Sep 2010
    26 Jan 2011
    Link to this post
    Hi,
    I am trying to use the GetContent method from ContentManager to retrieve all of the content items from a specific library (in other words by parentID) AND with a specific category.  I am trying to use GetContent(Int32,Int32,IMetaSearchInfo[],Guid[]) to achieve this.  However, I get this error in VS2010:

    Argument 4: cannot convert from 'System.Guid' to 'Telerik.Cms.Engine.IMetaSearchInfo'

    If I just do a GetContent(IMetaSearchInfo[]) it works fine.

    According to your API documentation (AND intellisense) this should work, yet its telling me that it's looking for IMetaSearchInfo where I supply the ParentID guid.

    Why is it doing this and is there maybe a better way to achieve what I am trying to do here?

    My code:

    ContentManager cm = new ContentManager("Libraries");
    LibraryManager lm = new LibraryManager();
    ILibrary library = lm.GetLibrary(LibraryName);
    IList categories = cm.GetCategories();
    foreach (ICategory cat in categories)
    {
        IMetaSearchInfo filter = new MetaSearchInfo(MetaValueTypes.ShortText, "Category", cat.CategoryName);
        IList item = lm.GetContent(0, 0, filter, library.ID);

    Again, if I just do ILIst item = lm.GetContent(filter) it works fine.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Jan 2011
    Link to this post
    Hello Keith,

    Please check this code sample - Get filtered subset of content with specified starting position and maximum number, and specified parent IDs:

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
2 posts, 1 answered