What is the Namespace for CreateIfNotExists?

asp.net-mvc-2, azure

Solution

CreateIfNotExists is part of version 2.0 of the Azure libraries.

If you are using the version 1.7 StorageClient namespaces then you need to call CreateIfNotExist (no plural)

Problem

In my application I'm trying to upload the documents in to Azure blob storage. The code is: ``` // Namespaces for Azure using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.StorageClient; public ActionResult GetPdf(HttpPostedFileBase document) { int pdfocument = Request.ContentLength; var doctype=Request.ContentType; byte[] pdf = new byte[pdfocument]; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("Setting1")); CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference("containername"); container.CreateIfNotExists(); var permissions = container.GetPermissions(); permissions.PublicAccess = BlobContainerPublicAccessType.Blob; container.SetPermissions(permissions); string uniqueBlobName = "blobname"; CloudBlockBlob blob = container.GetBlockBlobReference(uniqueBlobName); blob.Properties.ContentType = doctype; blob.UploadByteArray(pdf); } ``` When I build my application I get an error at `container.CreateIfNotExists()`. The error is: 'Microsoft.WindowsAzure.StorageClient.CloudBlobContainer' does not contain a definition for 'CreateIfNotExists' and no extension method 'CreateIfNotExists' accepting a first argument of type 'Microsoft.WindowsAzure.StorageClient.CloudBlobContainer' could be found (are you missing a using directive or an assembly reference?)'. Which namespace can I add for that error?

Original source