Copied to clipboard

Flag this post as spam?

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


  • Paul A 133 posts 368 karma points
    Jan 05, 2012 @ 00:30
    Paul A
    0

    doc.getProperty("xxx").Value throws exception

    Hi,

    v4.7.1.

    Have written some code allowing nodes to be created via webform. Was all working fine. I added a few props to the doctype and can't seem to access these. All other docs are available and working fine:

    doc.getProperty("photo1Title").Value = "Whatever" (throws 'object not set' exception)

    photo1Title definitely exists and is a text string. Anything I'm missing? Does something (cache?) need clearing out? I've nudged web.config, republished site and tried whispering sweetly to the code.

    Cheers,

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Jan 05, 2012 @ 05:40
    Markus Johansson
    1

    Hi Paul!

    Did you right click the root node and clicked "Republish"? That should update the cache. Do you update the cache when the document is created using umbraco.library.UpdateDocumentCache(int docId)?

    If you have a look at the cached XML (found in /app_data/umbraco.config) can you see your added values there? (More on the XML-cache: http://our.umbraco.org/forum/templating/templates-and-document-types/16048-Complete-XML-schema-of-umbraco)

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jan 05, 2012 @ 08:17
    Stefan Kip
    1

    Have you checked if 'doc' isn't null? :-)

  • Paul A 133 posts 368 karma points
    Jan 05, 2012 @ 10:23
    Paul A
    0

    Cheers both I'll have a look at those tonight... Node is being created fine, other properties being filled correctly. The ones throwing null are ones I'd added last night so I was wondering if there was some cache somewhere that wasn't updated.

    Will get back if anything useful found. Ta,

  • Paul A 133 posts 368 karma points
    Jan 05, 2012 @ 21:54
    Paul A
    1

    Don't you wish you could quietly delete a post and hope nobody notices?

    Fixed. Typos in code hard to spot at 11pm.

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Jan 05, 2012 @ 21:56
    Markus Johansson
    1

    What was the problem? :D

  • Paul A 133 posts 368 karma points
    Jan 05, 2012 @ 22:00
    Paul A
    0

    Originally I just had one photo as property so had named it 'photoBlog'... Later added others photo2Blog, photo3Blog... In the code I was referencing photo1Blog.

    I'll get my coat.

Please Sign in or register to post replies

Write your reply to:

Draft