Umbraco 4 Document url and Examine GatheringNodeData
Hi
i have an umbraco v 4.11.10 (Assembly version: 1.0.4926.14927) installation and inside GatheringNodeData event handler i try to access to the url of the document because i want to store the document (some properties plus the url) inside an Elastic Search server.
This is my event handler:
void ExamineEvents_GatheringNodeData(object sender, IndexingNodeDataEventArgs e) {
int id = e.NodeId;
string url = string.empty;
var node = new Node(e.NodeId);
//UmbracoContext.Current -> null
url = node.Url; //throw an Exception: Value cannot be null. Parameter name: umbracoContext
url = node.NiceUrl; //throw an Exception: Value cannot be null. Parameter name: umbracoContext
url = umbraco.library.NiceUrl(node.Id); //throw an Exception: Value cannot be null. Parameter name: umbracoContext
}
The problem is that Url(),NiceUrl() and umbraco.library.NiceUrl() method throw an exception (i suppose the problem is that this code runs outside request pipeline so umbracoContext is null).
There's a way to retrive the document url inside examine GatheringNodeData event?
Umbraco 4 Document url and Examine GatheringNodeData
Hi
i have an umbraco v 4.11.10 (Assembly version: 1.0.4926.14927) installation and inside GatheringNodeData event handler i try to access to the url of the document because i want to store the document (some properties plus the url) inside an Elastic Search server.
This is my event handler:
}
The problem is that Url(),NiceUrl() and umbraco.library.NiceUrl() method throw an exception (i suppose the problem is that this code runs outside request pipeline so umbracoContext is null). There's a way to retrive the document url inside examine GatheringNodeData event?
thanks so much
I'm facing the same issue (Umbraco 7.1.8).
If anyone could shed some light on this question, I would me much obliged :)
is working on a reply...