Wild Goat
Wild Goat

Reputation: 3579

Accessing Azure with a CloudStorageAccount

I have Console application which submit messages to Azure queue. Now I am trying to migrate this application to Mobile, but met reference problem with CloudStorageAccount. It requires Windows dll version but mine is Mobile.

Do you guys have any idea how I can initialize CloudStorageAccount object alternative way?

   public Initializator()
    {
        CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
        {
            // for a console app, reading from App.config
            configSetter(ConfigurationManager.ConnectionStrings[configName].ConnectionString);
        });


        CloudStorageAccount storageAccount = CloudStorageAccount.FromConfigurationSetting("QueueStorage");
        CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();


        queueIn = queueClient.GetQueueReference("queuein");

        queueOut = queueClient.GetQueueReference("queueout");

        queueIn.CreateIfNotExist();

        queueOut.CreateIfNotExist();
    }

Upvotes: 0

Views: 425

Answers (1)

mcollier
mcollier

Reputation: 3719

One of the easiest ways, in my opinion, to work with Windows Azure storage (tables, blobs, & queues) from Windows Phone is to use the Phone.Storage NuGet package (http://www.nuget.org/packages/Phone.Storage). This makes working with storage on the phone nearly identical to working with storage from a server (or console app).

Be sure to check out Wade Wegner's blog post at http://www.wadewegner.com/2011/11/nuget-packages-for-windows-azure-and-windows-phone-developers/ for some additional info on the NuGet packages.

There's also a Phone.Storage.Sample package that may be worth taking a look at.

Upvotes: 1

Related Questions