I am having the exact same issue (see: our.umbraco.org/forum/developers/api-questions/22168-Listing-Media-from-a-folder-through-net-usercontrols), except mine is when I am trying to access the Node of a media folder. Did you ever happen to figure out what the problem was? I am in desparate need of some help here, I have been debugging and researching this for hours. Thanks a lot!
I'm having a similar issue, hope someone can shed some light on this as I'm going slightly mad!
I created a Document Type called 'Circuit', with property ID 1077. I then created a node from it and published it. I'm connecting to a MS SQL Server database.
In my MVC 4 Web API app, in my Home Controller, I have this:
public ActionResult Index()
{
umbraco.library.GetXmlNodeById("1077");
umbraco.NodeFactory.Node myNode = new umbraco.NodeFactory.Node(1077);
return View(myNode);
}
When I run it, I get -
System.NullReferenceException: Object reference not set to an instance of an object.
umbraco.library.GetXmlNodeById(String id) +77
Any ideas? I've tried other node Ids and it's giving me the same issue.
Get Node by ID fails
Hi there
I have a strange problem, i have created a Document Type called 'Frontpage Banners'.
I made a node of this type and published it, i can see the node in the umbraco.config xml file under data\ and in the cmsContentXml table.
But when i try to retrieve it from c# using:
XPathNodeIterator it = umbraco.library.GetXmlNodeById("4236");
4236 is the NodeId seen in umbraco backend and database.
I am being told there is no published node with that ID, even though Umbraco backend tells me it is published.
Retreiving by xpath is no success either :-(
I have tried to delete umbraco.config, restart IIS, delete the node, make a new one (of course used the new ID)
Absolut no success :-(
Does anyone have any clue what the problem is ?
The funny thing is if i try to get any other node the same way it works.
In the umbraco.config file i have the following xml (just a snippet)
<node id="4236" version="b0529b7c-298c-426d-b2cc-17b34dab7b7b" parentID="-1" level="1" writerID="5" creatorID="5" nodeType="4234" template="0" sortOrder="6" createDate="2010-01-18T14:21:19" updateDate="2010-01-19T14:20:44" nodeName="Banners Frontpage" urlName="banners-frontpage" writerName="Søren Reinke" creatorName="Søren Reinke" nodeTypeAlias="BannersFrontpageFolder" path="-1,4236">
<node id="4243" version="63a9f5b3-dc4e-4cb6-ada4-9bb16aae97b0" parentID="4236" level="2" writerID="5" creatorID="1" nodeType="4237" template="0" sortOrder="0" createDate="2010-01-18T15:38:53" updateDate="2010-01-19T14:20:45" nodeName="NameRemoved" urlName="NameRemoved" writerName="Søren Reinke" creatorName="Webadmin" nodeTypeAlias="BannersFrontpage" path="-1,4236,4243">
<data alias="Date">1986-05-29T00:00:00</data>
<data alias="Image" />
<data alias="PredefinedType">57</data>
<data alias="Text"><![CDATA[REMOVED]></data>
</node>
If i in c# do this:
var nodes = umbraco.library.GetXmlNodeById("4236");
The InnerXml of the Current property is:
<error>No published item exist with id 4236</error>
How can that be, when the nodes are published ?
Is there a bug in Umbraco ?
Hi,
what happens if you use:
and for example query for the date property?
Cheers,
/Dirk
Hi Dirk
Thanks for your answer.
Your first code line only returns a completly empty node, everything is 0, null, "" and data like that.
Any other nodeID works perfectly.
But the funny thing is a line like:
Works perfectly, so Umbraco knows the node exists.
I have a bad feeling the database might be broken somehow.
Does there exist a tool, that can validate/repair the datastructure in the database ?
Is this a problem for all nodes you try to access, or just a problem with this particular one?
You said you tried to delete and create it again, and still it didn't work.
Does it work for other types of nodes?
Is this a project with umbraco PRO+Support subscribtion? - in that case, you can try to let the Core team take a look at the database.
/Dennis
Strange have been debugging around for like forever, for some weird reason it is now working again :-(
I have no clue why, but at least i can continue.
Thanks a lot for your input.
Hello,
I am having the exact same issue (see: our.umbraco.org/forum/developers/api-questions/22168-Listing-Media-from-a-folder-through-net-usercontrols), except mine is when I am trying to access the Node of a media folder. Did you ever happen to figure out what the problem was? I am in desparate need of some help here, I have been debugging and researching this for hours. Thanks a lot!
Cheers!
- Dom
Hey guys!
I'm having a similar issue, hope someone can shed some light on this as I'm going slightly mad!
I created a Document Type called 'Circuit', with property ID 1077. I then created a node from it and published it. I'm connecting to a MS SQL Server database.
In my MVC 4 Web API app, in my Home Controller, I have this:
public ActionResult Index()
{
umbraco.library.GetXmlNodeById("1077");
umbraco.NodeFactory.Node myNode = new umbraco.NodeFactory.Node(1077);
return View(myNode);
}
When I run it, I get -
System.NullReferenceException: Object reference not set to an instance of an object.
umbraco.library.GetXmlNodeById(String id) +77
Any ideas? I've tried other node Ids and it's giving me the same issue.
Thanks
Ross
I have the same issue. Any ideas.
is working on a reply...