Copied to clipboard

Flag this post as spam?

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


  • vapenation 21 posts 139 karma points
    Dec 09, 2016 @ 14:04
    vapenation
    0

    Triggering import/export on Umbraco-sites from external command line

    My project requires me to find some way to execute an important on an Umbraco site from a simple console app. I know that I can use the Usync API to trigger an import from the site itself:

            var uSyncBackOffice = new uSyncBackOfficeContext();
            var actions = uSyncBackOffice.ImportAll();
    

    Essentially what my program will do is:

    1. Transfer content from usync/data from site A to the corresponding folder on site B.
    2. Trigger an import on site B.

    Assuming that the program has the necessary permissions on the host server and of course the usync nuget package onboard, how would I write this?

    I'm assuming the I need to initialize a uSyncBackOfficeContext but I couldn't find any methods for defining an IIS site or any other connection settings. I am also aware that Arron Powell's Chauffeur might be able to do this for me but it seems outdated or incomplete as I haven't been able to find a version I can compile.

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Dec 09, 2016 @ 14:15
    Kevin Jump
    100

    As if by magic : )

    https://www.nuget.org/packages/uSync.Chauffeur/

    you can trigger imports from the command line with this.

    sort of docs here : https://github.com/KevinJump/uSync/blob/Dev-v7_4/Jumoo.uSync.Chauffeur/uSyncDeliverable.cs#L225

  • vapenation 21 posts 139 karma points
    Dec 09, 2016 @ 14:55
    vapenation
    0

    Yes, I'm looking at the uSync.Chauffeur class library now, but I was wondering if you had some sample code or some boilerplate command line app to get started? Because, as far as I can see, uSync.Chauffuer doesn't include any executable, just class libraries.

    Update

    I wasn't aware that Chauffeur was to reside in the Umbraco site's bin-folder. Blaming it on poor documentation. ^^ You can disregard my answer. I will try this on my end and mark your answer as the solution if it works.

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Dec 09, 2016 @ 14:18
    Kevin Jump
    0

    if you need to trigger something across sites then you might be better putting an API end point in that you can hit remotely.

    so if you look at something like https://github.com/KevinJump/uSync/blob/Dev-v7_4/Jumoo.uSync.BackOffice/Controllers/uSyncBackOfficeController.cs#L31

    you can actually hit an import via the url

    /umbraco/backoffice/usync/uSyncBackOffice/ImportAll

    but you have to be authenticated by umbraco to do that.

    if you wrote your own. you could make it unauthenticated so it could be called from somewhere else. but you would want to secure it somehow (iis restrictions or keys or something)

  • vapenation 21 posts 139 karma points
    Dec 09, 2016 @ 14:53
    vapenation
    0

    That was my original solution but it might not be an option due the way our production IIS is set up.

Please Sign in or register to post replies

Write your reply to:

Draft