public object GetBlobList() { //--Connection String -- //storage account CloudStorageAccount objStorage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("BlobConnectionString")); // get the Client reference using storage blob end point CloudBlobClient objClient = new CloudBlobClient(objStorage.BlobEndpoint, objStorage.Credentials); // Get Container reference CloudBlobContainer blobContainer = objClient.GetContainerReference("mycontainer"); // Create the container if it does not exist blobContainer.CreateIfNotExists(); //set public permission blobContainer.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob }); List<object> imageUriList = new List<object>(); //list blobs in the container IEnumerable<IListBlobItem> objBlobList = blobContainer.ListBlobs(); foreach (IListBlobItem objItem in objBlobList) { var imageUri = new { ImageURI = objItem.Uri }; imageUriList.Add(imageUri); } //var javaScriptSerializer = new JavaScriptSerializer(); //return javaScriptSerializer.Serialize(imageUriList); return imageUriList; }
/// <summary> /// Initializes a new instance of the <see cref="TestRoleInstance" /> class. /// </summary> /// <param name="parentRole">The parent role.</param> /// <param name="ordinal">The ordinal.</param> public TestRoleInstance(Azure.Role parentRole, int ordinal) { this.parentRole = parentRole; this.ordinal = ordinal; }