Create Container Programmatically in Windows Azure
Step 1: Create storage.
Create 2: Now Create Windows 8 App or any other App or Project.
Right click on “References” & select “Manage NuGet Packages…”
Enter the term for search “Windows Azure Storage”
Step 3: after installation Windows Azure Storage Package or DLL added to the App.
Step 4: Open MainPage.xaml.cs file
First add references
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using Windows.UI.Popups;
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
// Retrieve storage account from connection string
CloudStorageAccount storageAccount = new CloudStorageAccount(
new StorageCredentials("forttestingnew",
"rYxKzO5nz9h6LEKZlX2TWXtJHeuJ2d0a+3jytW9QWX6JmBcgut1g8GhFAmvfV5SiEEHdKCI0nGG1IdCSTw9UVg=="), true);
// Create the blob client
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container
CloudBlobContainer container = blobClient.GetContainerReference("mynewcontainer");
await container.CreateIfNotExistsAsync();
// Make the Container publicly visible
BlobContainerPermissions permissions = new BlobContainerPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Blob;
await container.SetPermissionsAsync(permissions);
var msgDlg = new MessageDialog("Container Successfully Created.");
await msgDlg.ShowAsync();
}
Before run the app.
Now run the app.
Go to Windows Azure Management Portal
Open Storage
Step 1: Create storage.
Create 2: Now Create Windows 8 App or any other App or Project.
Right click on “References” & select “Manage NuGet Packages…”
Enter the term for search “Windows Azure Storage”
Step 3: after installation Windows Azure Storage Package or DLL added to the App.
Step 4: Open MainPage.xaml.cs file
First add references
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using Windows.UI.Popups;
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
// Retrieve storage account from connection string
CloudStorageAccount storageAccount = new CloudStorageAccount(
new StorageCredentials("forttestingnew",
"rYxKzO5nz9h6LEKZlX2TWXtJHeuJ2d0a+3jytW9QWX6JmBcgut1g8GhFAmvfV5SiEEHdKCI0nGG1IdCSTw9UVg=="), true);
// Create the blob client
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container
CloudBlobContainer container = blobClient.GetContainerReference("mynewcontainer");
await container.CreateIfNotExistsAsync();
// Make the Container publicly visible
BlobContainerPermissions permissions = new BlobContainerPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Blob;
await container.SetPermissionsAsync(permissions);
var msgDlg = new MessageDialog("Container Successfully Created.");
await msgDlg.ShowAsync();
}
Before run the app.
Now run the app.
Go to Windows Azure Management Portal
Open Storage
No comments:
Post a Comment