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 778 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 863 posts 3849 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

     

Please Sign in or register to post replies

Write your reply to:

Draft