locked
How do you list blobs in a container for Windows phone 8? RRS feed

  • Question

  • I want to list file names of the blobs in a container on my Azure server using Windows Phone 8.

    I'm using this: using Microsoft.WindowsAzure.Samples.Phone.Storage;

    Library is: Windows Azure Storage Client Library for Windows Phone v1.0.1.

    The library has been deprecated, but it's the only one that will work with WP8. (Unless someone knows of another one?)

    Code:

    ICloudBlobContainer container = blobClient.GetContainerReference("containerName");

    I'm not sure what arguments to pass to this:

    container.ListBlobs()

    Visual Studios recommendation is this:

    Action<CloudOperationResponse<IEnumerable<ICloudBlob>>> callback

    But I don't know what that is. Anyone know?

    Saturday, July 27, 2013 7:16 PM

Answers

  • Hi,

      >> But I don't know what that is.

    From the signature, looks like you can write code such as:
     
    container.ListBlobs((response) => {});
     
    In the body of the delegate method, you can get the details of the response.

      >>  The library has been deprecated, but it's the only one that will work with WP8. (Unless someone knows of another one?)

    Please note, it is needed to embed your storage account key in your mobile app in order to access blob storage directly. This is dangerous as hackers may be able to figure out what the key is, and may use it to harm you. That's one of the reason why this library is discontinued. It is highly recommended that you use a service to work with blob storage, and talk with the service from your mobile app. For instance, you can write a Mobile Service script that access blob storage (which runs on the server and thus does not require to embed the key in your mobile app), and use the Mobile Service SDK (http://www.windowsazure.com/en-us/downloads/?sdk=mobile) in your mobile app.

    Best Regards,

    Ming Xu


    Ming Xu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 29, 2013 1:29 AM
  • Hi,

      >> This is JavaScript correct? Can these scripts access my storage?

    Yes, the language is JavaScript. But to be more specific, it is Node.js, which is JavaScript run on the server. You can find a detailed tutorial on how to access blob storage from Mobile Services in http://chrisrisner.com/Mobile-Services-and-Windows-Azure-Storage. In essence, please write var azure = require('azure'); And then you can use the azure variable to access Azure storage.

    Best Regards,

    Ming Xu


    Ming Xu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 30, 2013 7:20 AM

All replies

  • Hi,

      >> But I don't know what that is.

    From the signature, looks like you can write code such as:
     
    container.ListBlobs((response) => {});
     
    In the body of the delegate method, you can get the details of the response.

      >>  The library has been deprecated, but it's the only one that will work with WP8. (Unless someone knows of another one?)

    Please note, it is needed to embed your storage account key in your mobile app in order to access blob storage directly. This is dangerous as hackers may be able to figure out what the key is, and may use it to harm you. That's one of the reason why this library is discontinued. It is highly recommended that you use a service to work with blob storage, and talk with the service from your mobile app. For instance, you can write a Mobile Service script that access blob storage (which runs on the server and thus does not require to embed the key in your mobile app), and use the Mobile Service SDK (http://www.windowsazure.com/en-us/downloads/?sdk=mobile) in your mobile app.

    Best Regards,

    Ming Xu


    Ming Xu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 29, 2013 1:29 AM
  • Can you point me to a tutorial that will show me how to do run a script that will access my storage? I created a mobile service and saw that I can run scripts when a table is updated, read, etc. This is JavaScript correct? Can these scripts access my storage?
    Tuesday, July 30, 2013 12:58 AM
  • Hi,

      >> This is JavaScript correct? Can these scripts access my storage?

    Yes, the language is JavaScript. But to be more specific, it is Node.js, which is JavaScript run on the server. You can find a detailed tutorial on how to access blob storage from Mobile Services in http://chrisrisner.com/Mobile-Services-and-Windows-Azure-Storage. In essence, please write var azure = require('azure'); And then you can use the azure variable to access Azure storage.

    Best Regards,

    Ming Xu


    Ming Xu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 30, 2013 7:20 AM