Copied to clipboard

Flag this post as spam?

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

  • Dawid 26 posts 136 karma points c-trib
    Jan 24, 2018 @ 13:36

    UmbracoHelper.TypedContent returns null for new document in GetheringNodeData

    I'm using Umbraco version 7.6.11.

    In GatheringNodeData event I'm trying to collect the Urllink and add it to Index. To get the Url I need to get IPublishedContent object. To get that I've tried to us the UmbracoHelper.TypedContent. ![enter image description here][1]

    Item is visible in the database

    var person = umbracoHelper.TypedContent(nodeData.Fields["id"]);
    UmbracoContext context;
    if (UmbracoContext.Current == null)
       var worker = new SimpleWorkerRequest("/", string.Empty, new StringWriter());
       var httpContext = new HttpContext(worker);
       var dummyContext = new HttpContextWrapper(httpContext);
       context = UmbracoContext.EnsureContext(
           new WebSecurity(dummyContext, ApplicationContext.Current),
          context = UmbracoContext.Current;
     var helper = new UmbracoHelper(context);
     person = helper.TypedContent(nodeData.NodeId);
     if (nodeData.Fields.ContainsKey("content") && nodeData.Fields.ContainsKey("id") && person != null)

    Person is null. This Document exists in database but doesn't exists in the umbraco.Config file, so I guess it is not in the Content cache.

    I cannot use the ApplicationContext.Current.Services.ContentService.GetById(nodeData.NodeId), becuase I will not get the Url to the document.

    What I'm doing wrong? Can I get the Url in other way ?

  • Alex Skrypnyk 4637 posts 16596 karma points MVP 2x admin
    Jan 30, 2018 @ 13:22
    Alex Skrypnyk

    Hi Dawid

    Try this one:



  • Alex Skrypnyk 4637 posts 16596 karma points MVP 2x admin
    Feb 13, 2018 @ 14:43
    Alex Skrypnyk

    Hi Dawid,

    Did you find a solution? Share with our community, please


  • John Bergman 314 posts 841 karma points
    Feb 14, 2018 @ 05:29
    John Bergman

    In your first line, what type of object is nodeData? Do you have property converters turned on?

  • Dawid 26 posts 136 karma points c-trib
    Feb 14, 2018 @ 07:45

    The nodeData variable is of type : IndexingNodeDataEventArgs. No I dont have property converter turned on. How can I benefit from the property converter?

  • Dawid 26 posts 136 karma points c-trib
    Feb 14, 2018 @ 07:49

    So my solution to this was using ContentService and used ToUrlSegment method as it seems that I don't need full url, but only current page url segment.

    So I guess I could get rid of the ContentService method and just base on the nodeData variable.

Please Sign in or register to post replies

Write your reply to: