Copied to clipboard

Flag this post as spam?

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


  • Elad Lachmi 112 posts 144 karma points
    Jan 05, 2012 @ 07:04
    Elad Lachmi
    0

    Access document type properties from code-behind

    Hi,

    I am adding some new features to an Umbraco extension I made several month ago.

    In this extension I create an email using String.Format and an HTML string I get from the DB.

    Some of the parameters I need in the string.format method are located in pages on the site.

    I'm guessing I need to get the page object by name and then access the properties of it's document type,

    but I have no idea where to even begin.

     

    Thank you!

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 05, 2012 @ 14:40
    Tom Fulton
    100

    Hi Elad,

    You can use the NodeFactory or Document APIs to get properties from nodes.  If you're only looking for published data, use the NodeFactory as it queries the XML cache so it's much faster.  Or if you need unpublished nodes/data you'll need to use the Document API.  (see Difference between Node and Document for more info)

    This wiki has an example of how to use NodeFactory to grab a node by ID and get properties:  Working with NodeFactory

    Check it out and let us know if you run into any problems :)

    -Tom

Please Sign in or register to post replies

Write your reply to:

Draft