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.
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)?
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.
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.
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,
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)
Have you checked if 'doc' isn't null? :-)
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,
Don't you wish you could quietly delete a post and hope nobody notices?
Fixed. Typos in code hard to spot at 11pm.
What was the problem? :D
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.
is working on a reply...