Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Eduardo 106 posts 130 karma points
    Nov 15, 2010 @ 12:38
    Eduardo
    0

    Retrieving nodes of type 'x'

    Hi,

    I have created a new section where I want to create,delete and show nodes of type "Library". How can I do this?

    Thanks beforehand.

    Sincere regards,
    Eduardo Macho

  • Arnold Visser 418 posts 763 karma points hq c-trib
    Nov 15, 2010 @ 15:38
    Arnold Visser
    1

    To get all the documents which are using the "library" doctypealias you can use the following code:

    DocumentType langDocType = DocumentType.GetByAlias("Library");
  • Hendy Racher 861 posts 3844 karma points MVP 2x admin c-trib
    Nov 15, 2010 @ 16:27
    Hendy Racher
    1

    Hi,

    The above code gets an instance of the DocumentType, which is required for creating new nodes of a given docType.

    To enumerate nodes of that docType (as mentioned in this post):

    IEnumerable<Document> documents = Document.GetDocumentsOfDocumentType(langDocType.Id);

    (If dealing with just published nodes I tend to use an XPath expression to get all documents of a particular docType)

    HTH,

    Hendy

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies