Copied to clipboard

Flag this post as spam?

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


  • greengiant83 88 posts 109 karma points
    Mar 16, 2011 @ 20:41
    greengiant83
    0

    Walking the Document tree hierarchy

    I find myself needing to walk up and down the document tree looking for certain types of documents frequently.  For instance lets say I have a tree that looks like this:

     

    • Client A
    • Event List
    • Event A
    • Participants
    • Event B
    • Participants
    • Client B
    • .....
    If I am on the participants node under client a's event a, I might need to walk up the document tree to find out what Event or Client its under.  Or on the other side of the tree I might be at the Client node and want to find a list of all Events.
    When using the NodeFactory's INode walking around based on Document Type is no big deal because all INode's have a NodeTypeAlias property.
    When using Document it is a bit more of a challenge because Document while Document's children are also Documents which has a ContentType object, its parent is a CMSNode which only has nodeObjectType which is a GUID. 
    Walking based on the GUID is annoying because if you are trying to walk based on the Alias you have to do a seperate look up to find the DocumentType's guid first.  
    Is there a way to walk the document tree without having to look up the doc type's guid? Barring that, is there a place to look up a doc type's guid based on alias without inccuring a database call?

     

  • Harald Ulriksen 207 posts 249 karma points
    Mar 17, 2011 @ 08:37
    Harald Ulriksen
    0

    Hi,

    documents are slow and should only be used when you need to change data. Suggest you navigate your tree using nodefactory. When you've located the node you need to change you can instantiate a document for it using the node id.

    Cheers,
    Harald

  • greengiant83 88 posts 109 karma points
    Mar 17, 2011 @ 15:26
    greengiant83
    0

    Harald,

    For certain parts of my application I need to get at the latest saved content. As I understand it using the nodefactory node's limits you to only published content.  If there is a way to get saved content via the nodefactory I would much prefer to go that route.  Is there a way to do that?

     

    Not that it concerns me at the moment, but if you try to find your document by walking the nodefactory tree dont you run the risk of not finding new unpublished nodes?

Please Sign in or register to post replies

Write your reply to:

Draft