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

Forums / Developing with Sitefinity / Getting Content through API

Getting Content through API

5 posts, 0 answered
  1. Dave
    Dave avatar
    76 posts
    Registered:
    10 Mar 2008
    11 Mar 2008
    Link to this post
    Is there a method in the API that would retrieve a list of content given a Category Name or GUID, or an array of Tags?

    Also... can one access related Content items (TextContent, BinaryContent, etc.) given a CmsContentBase object through the API?
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    11 Mar 2008
    Link to this post
    Hi Dave,

    Yes, there is such method. There are several override methods with name GetContent. For more information, please refer to Developers Manual -> ContentManager -> Methods -> GetContent method.

    About your second question, can you please elaborate a little more?

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Dave
    Dave avatar
    76 posts
    Registered:
    10 Mar 2008
    11 Mar 2008
    Link to this post
    I did see the GetContent overloads, but I didn't notice anything about categories or tags, unless IMetaSearchInfo can be used?

    Regarding my second question, I'd basically like to be able to access the actual text of a CmsContentBase object.  Is this something that would better be accomplished through the DAL?
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    12 Mar 2008
    Link to this post
    Hello Dave,

    Okay, here are two methods you could use, without IMetaSearchInfo :

    public IList GetContent(  
       int from, 
       int max, 
       string sortExp, 
       string tagName, 
       Nullable<Guid> parentId 

    public IList GetContent(  
       int from, 
       int max, 
       string sortExp, 
       string tagName 

    The IList holds IContent items. Now, if you would like to take the text of given content, you could simply use :

    string text = IContent.Content.ToString();

    The actual text of CmsContentBase object can be accessed again with Content.ToString();

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Dave
    Dave avatar
    76 posts
    Registered:
    10 Mar 2008
    12 Mar 2008
    Link to this post
    Excellent, thank you for your patience.
Register for webinar
5 posts, 0 answered