Copied to clipboard

Flag this post as spam?

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


  • Frank Buchner 22 posts 90 karma points
    Aug 15, 2011 @ 18:19
    Frank Buchner
    0

    Courier API - Courier Webservice Items

    Hi,

    I am currently developing a packaging utility to take items from a remote development server and send them to a separate remote production server. I have been looking at the Courier Developers guide but am having an issue trying to understand how a to get all items from an item provider via a courier webservice repository provider. The following calls don't seem to be correct and give me compile errors:

    ...

    using Umbraco.Courier.Core;
    using Umbraco.Courier.Core.Storage;
    using Courier.RepositoryProviders;

    ...

     

    engine.RemotePackagerUrl = "domain.com";
    engine.RemotePackagerUser = "admin";
    engine.RemotePackagerPassword="meh";

    I have tried the following instead:

    PackagingManager manager = PackagingManager.Instance;

    RepositoryProviders.CourierWebserviceRepositoryProvider cp = new RepositoryProviders.CourierWebserviceRepositoryProvider();
    cp.Login = "admin";
    cp.Password = "mypassword";
    cp.PasswordEncoding = "Hashed";
    cp.UserId = 0;
    cp.Url = "http://www.myurl.com";

    Repository r = new Repository(cp);
    r.Name = "www.myurl.com";
    r.Alias = "staging";

    manager.Load(Path.Combine(directory, "testingDirectory"));
    manager.EnableRemoteExtraction(r);

    if (manager.ConnectToRemoteExtractor(out err))
    {
    Console.WriteLine("CONNECTED");

    } else {

    Console.WriteLine("CONNECTION FAILED");

    }

    List<ItemIdentifier> itemsToPackage = new List<ItemIdentifier>();
    foreach (var provider in Umbraco.Courier.Core.ProviderModel.ItemProviderCollection.Instance.GetProviders())
    {
    foreach (var item in provider.AvailableSystemItems())
    {
    items.ToPackage.Add(item.ItemId); /// These for loops don't get me any item providers or items.

    }

    }

    I'm pretty sure I'm going about this the wrong way in an effort to get around the inability to use the proper RemotePackagerUrl, RemotePackagerUser and RemotePackagerPassword calls as I'm sure that setting up the ConnectToRemoteExtractor isn't what I want (but is the only thing that seems applicable in my VS's Intellisense). What would be really helpful is an example of connecting to a remote Courier webservice and getting all items available to be transferred.

    Any insights would be appreciated! Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft