Thanks Nik, its not a spelling error though its always wise to check th obvious. I dug deeper into my visual studio value watch properties and found the following error:
at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at umbraco.cms.businesslogic.datatype.controls.Factory.GetNewObject(Guid DataEditorId) at umbraco.cms.businesslogic.datatype.controls.Factory.DataType(Guid DataTypeId) at umbraco.cms.businesslogic.datatype.DataTypeDefinition.get_DataType() at umbraco.cms.businesslogic.property.Property..ctor(Int32 Id) at umbraco.cms.businesslogic.Content.InitializeProperties() at umbraco.cms.businesslogic.Content.get_GenericProperties()
I am not familier with this conde but it seems that the get_GenericProperties() method is failing for the Document object???
Error using api, accessing a documents properties failing
'((umbraco.cms.businesslogic.Content)(temp)).GenericProperties' threw an exception of type 'System.Collections.Generic.KeyNotFoundException'
I am using the following code:
Document doc = new Document(1055);
foreach (Document childDoc in doc.Children)
{
Document temp = new Document(childDoc.UniqueId);
temp.getProperty("NoOfBizLessThan12").Value = 13;
}
The exception is thrown when using the getproperty method. I have also tried using getproperties but this also throws the same exception.
Any ideas?
The only thing I can think of is that you have a typo in the property name or referenceing a proprty that does not exist on that doc type.
Obvious maybe, but I know I glance over typos all the time :)
Thanks,
Nik
Thanks Nik, its not a spelling error though its always wise to check th obvious. I dug deeper into my visual studio value watch properties and found the following error:
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at umbraco.cms.businesslogic.datatype.controls.Factory.GetNewObject(Guid DataEditorId)
at umbraco.cms.businesslogic.datatype.controls.Factory.DataType(Guid DataTypeId)
at umbraco.cms.businesslogic.datatype.DataTypeDefinition.get_DataType()
at umbraco.cms.businesslogic.property.Property..ctor(Int32 Id)
at umbraco.cms.businesslogic.Content.InitializeProperties()
at umbraco.cms.businesslogic.Content.get_GenericProperties()
I am not familier with this conde but it seems that the get_GenericProperties() method is failing for the Document object???
I found this thread: http://our.umbraco.org/forum/developers/extending-umbraco/3499-Custom-data-type-issue?sort=newest
I copied all of the dll files from my server running umbraco to the bin of the project using the api and it started working
is working on a reply...