Take the 2-minute tour ×

I'm using the Windows Azure toolkit for Windows Phone, but I have difficulities to send a queue message to the cloud service. Here is my code:

public void SendQueueMessage(string queueReference, params string[] message)
        CloudQueue cloudQueue = new CloudQueue();
        CloudQueueClient queueClient = new CloudQueueClient(queueUri, credentials);

        StringBuilder sb = new StringBuilder();
        foreach (var messagePart in message)
        sb.Remove(sb.Length - 2, 1);
        CloudQueueMessage queueMessage = new CloudQueueMessage { AsBytes = Encoding.UTF8.GetBytes(sb.ToString()) };
        cloudQueue.AddMessage(queueMessage, r => this.dispatcher.BeginInvoke(() => 
                                                                                 if(r.Exception != null)
                                                                                     //handle exception

I'm always getting null exception at AddMessage method.Any ideas?

share|improve this question

1 Answer 1

I suspect you may have found out how to do this by now but after much looking I found how to add a queue to storage from Windows Phone via this episode of cloudcove r. You should be looking at around the 13:44 minute mark.


Hopefully, this will help you out

Edit: Having copied the code from the video it should look something like this:

  var queueClient = CloudStorageContext.Current.Resolver.CreateCloudQueueClient();
        var queue = queueClient.GetQueueReference("imagestodo");
        queue.Create(r => queue.AddMessage(
               new CloudQueueMessage
                   AsBytes = Encoding.UTF8.GetBytes(imageID),
                   Id = imageID
               c =>
                       //logic here
share|improve this answer
I've found the answer by watching the same video two weeks ago. Thanks, anyway. –  Rade Milovic Apr 21 '12 at 6:53

Your Answer


