Copied to clipboard

Flag this post as spam?

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


  • Taras 30 posts 151 karma points
    Oct 03, 2013 @ 16:22
    Taras
    0

    Get node's url in Console application

    I built a console application like this(using ContentService):

    https://github.com/sitereactor/umbraco-console-example

    But I don't know how get node's url?

    I can  get node's path, but how convert it to 'niceUrl'?

    I think as a solution to need simulate UmbracoContext, but I don't know how.

    Thanks.


  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Oct 03, 2013 @ 16:46
    Ismail Mayat
    1

    Taras,

    According to this http://our.umbraco.org/forum/developers/api-questions/39164-Console-Application-Publishing-Problem which you have already seen in the second post Morton says requirement for httpcontext so it may be the same when trying to do nice url?

    Usually you can do umbraco.library.NiceUrl(1234) but that needs web context for sure. You could try

    UmbracoContext.Current.ContentCache.GetById(someidhere).Url
    

    Regards

    Ismail

  • Taras 30 posts 151 karma points
    Oct 03, 2013 @ 17:09
    Taras
    100

    Ismail,

    Yes, I try use current context:

    var umbracoContext = UmbracoContext.Current;

    but "umbracoContext" is  null.

    p.s. actually umbraco http context is important, but I don't know how simulate it. as temporary solution I use web service and do all actions in site project(not in windows service). I only call web service method from windows service, not more. This message isn't true resolved of current question.

Please Sign in or register to post replies

Write your reply to:

Draft