Copied to clipboard

Flag this post as spam?

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


  • prl 32 posts 54 karma points
    Mar 30, 2010 @ 17:00
    prl
    0

    Getting node by its name

    Hello,

    I'm making a webservice that receives as a parameter a name of a node. The service should return the names of the child nodes of that node. Is this possible? How can I get a node from its name? In the webservice I have no notion of CurrentNode so I'm not getting how I should do this.

    Thanks!

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 30, 2010 @ 17:20
    Dirk De Grave
    0

    Hi prl,

    Consider rewriting the webservice to accept the id of the node, and retrieve a list of child nodes based on that node id (that is, if you're using the standard umbraco webservices);

    umbraco webservices can only return a list of child nodes based on a id, so it may take a while to get to the desired node (by comparing the node's name with the parameter returned from your service) if you have to invoke the webservice more than once (especially if you have a deep nested content structure and have to invoke the webservice recursively for each node

    Or, consider writing another webservice, hosted in your umbraco instance, that can query the umbraco instance using xpath or linq2umbraco and return a list of child nodes to the caller. 

    Latter is better solution imho as it only requires a single webservice call which can query the cached content xml pretty fast.

     

    Hope this helps.

    Regards,

    /Dirk

     

     

Please Sign in or register to post replies

Write your reply to:

Draft