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 02, 2013 @ 12:53
    Taras
    0

    Access Umbraco from Windows Service

    Can I connect to Umbraco from Windows Service?

    My current situation: I have website with Umbraco and I need periodically change some node's property.I must define new value of property using node's url. 

    How can I do it with Windows Service?

    Current solution to: using WebService in Windows Service, but it is slowly for this case.  

    Can I do it in Windows Service without WebService? 

    Is it possible?

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Oct 02, 2013 @ 14:15
    Ismail Mayat
    0

    Taras,

    What version of umbraco are you using? If its >6 then you can get the umbraco context outside of httpcontext and update things. If older version then you need to use umbraco document service or do it with web service.

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Oct 02, 2013 @ 14:23
    Ismail Mayat
    0

    Taras,

    Docs for content service http://our.umbraco.org/documentation/Reference/Management-v6/Services/ContentService

    And for document service i couldnt find any docs but see http://our.umbraco.org/forum/developers/api-questions/3257-Using-the-membership-web-service think you just modify the config to allow usage then add webservice reference for it.

    Regards

    Ismail

  • Taras 30 posts 151 karma points
    Oct 02, 2013 @ 15:55
    Taras
    0

    Ismail,

    Yes, I think it's what need. Now I try implemented it.

    But test code return NullReferenceException.:

    test code:

    using Umbraco.Core;

    using Umbraco.Core.Models;

    using Umbraco.Core.Services;

    ....

    var root = ApplicationContext.Current.Services.ContentService.GetById(-1);

     

    Current solution to: think need set properties in app.config file, but don't know what write there. Is there another solution to this situation?

     

    I use Umbraco version 6.0.5

    -thanks for your previous answer

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Oct 02, 2013 @ 16:20
    Ismail Mayat
    100

    Taras, Ok using 6.0.5 then this is the best way to do it. With regards to the app.config i think it just needs the connection string? Take a look at https://github.com/sitereactor/umbraco-console-example this is a console app using the application context see app.config https://github.com/sitereactor/umbraco-console-example/blob/master/UmbConsole/App.config

    Regards

    Ismail

  • Taras 30 posts 151 karma points
    Oct 02, 2013 @ 17:24
    Taras
    0

    Ismail, 

    Yes, it's great idea.

    This example project was very helpful for me.

    Thank you.

     

  • Taras 30 posts 151 karma points
    Oct 02, 2013 @ 23:43
    Taras
    0

    After all I can read and change node properties(using method SaveAndPublish).

    But I don't know how get node's url. I can get node path, but how convert it to url I cann't understand. I don't know why but for some reason NiceUrl is  not available .

Please Sign in or register to post replies

Write your reply to:

Draft