Copied to clipboard

Flag this post as spam?

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


  • Alessandro 21 posts 51 karma points
    Apr 15, 2014 @ 15:54
    Alessandro
    0

    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?

    thanks so much

  • Jan Vanuytrecht 32 posts 80 karma points
    Dec 03, 2014 @ 16:10
    Jan Vanuytrecht
    0

    I'm facing the same issue (Umbraco 7.1.8).

    If anyone could shed some light on this question, I would me much obliged :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies