{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-storage-net/issues/572","repository_url":"https://api.github.com/repos/Azure/azure-storage-net","labels_url":"https://api.github.com/repos/Azure/azure-storage-net/issues/572/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-storage-net/issues/572/comments","events_url":"https://api.github.com/repos/Azure/azure-storage-net/issues/572/events","html_url":"https://github.com/Azure/azure-storage-net/issues/572","id":274252250,"number":572,"title":"Blob container is not accessible and there is an error \"409\" while trying to access it via code","user":{"login":"ManishKatoch","id":6924467,"avatar_url":"https://avatars0.githubusercontent.com/u/6924467?v=4","gravatar_id":"","url":"https://api.github.com/users/ManishKatoch","html_url":"https://github.com/ManishKatoch","followers_url":"https://api.github.com/users/ManishKatoch/followers","following_url":"https://api.github.com/users/ManishKatoch/following{/other_user}","gists_url":"https://api.github.com/users/ManishKatoch/gists{/gist_id}","starred_url":"https://api.github.com/users/ManishKatoch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManishKatoch/subscriptions","organizations_url":"https://api.github.com/users/ManishKatoch/orgs","repos_url":"https://api.github.com/users/ManishKatoch/repos","events_url":"https://api.github.com/users/ManishKatoch/events{/privacy}","received_events_url":"https://api.github.com/users/ManishKatoch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-11-15T18:06:09Z","updated_at":"2018-02-07T21:51:28Z","closed_at":null,"author_association":"NONE","body":"I am working on a solution where I need to display information in blobs (text) on a website.\r\nThese blobs are actually log files and are being written (may be) when I try to access them. So the problem is specific to one of the blob containers. I am not able to access it or any files it contains and I am encountering a 409 error whenever I am trying to access that particular blob container.\r\n\r\nI am not sure how we can resolve it as it might be a case with that particular blob container only or may be because its constantly being written by some program while we try to access it.\r\nBut the error message is 409 and it doesn't contain any other information.\r\n\r\nPlease let me know what access do you need in order to get this done and I will try to get you the access.\r\n\r\n\r\nCode snippet:\r\n`using System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing System.Text;\r\nusing System.Web.Mvc;\r\nusing Microsoft.WindowsAzure.Storage;\r\nusing Microsoft.WindowsAzure.Storage.Auth;\r\nusing Microsoft.WindowsAzure.Storage.Blob;\r\nusing RetailApp.Web.Models.WebJobs;\r\n\r\nnamespace RetailApp.Web.Controllers\r\n{\r\n    public class WebJobsController : BaseController\r\n    {\r\n        static List<FileStructure> lts = new List<FileStructure>();\r\n        static bool flag = false;\r\n\r\n        // GET: WebJobs\r\n        public ActionResult Index()\r\n        {\r\n            return View();\r\n        }\r\n\r\n        static void WriteAzureDirectoriesToConsole(IEnumerable<CloudBlobContainer> containers, string strDate)\r\n        {\r\n            foreach (var container in containers)\r\n            {\r\n                string indent = \"\";\r\n                if (container.Name == \"prod-logs\")\r\n                {\r\n                    container.SetPermissions(new BlobContainerPermissions\r\n                    {\r\n                        PublicAccess = BlobContainerPublicAccessType.Blob\r\n                    });\r\n\r\n                    // Pass Ienumerable to recursive function to get \"subdirectories\":\r\n                    GetContainerDirectories(container.ListBlobs(), indent, strDate);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void GetContainerDirectories(IEnumerable<IListBlobItem> blobList, string indent, string strDate)\r\n        {\r\n            StringBuilder sb = new StringBuilder(\"\");\r\n\r\n            // First list all the actual FILES within the current blob list. No recursion needed:\r\n            foreach (var item in blobList.Where((blobItem, type) => blobItem is CloudBlockBlob))\r\n            {\r\n                var blobFile = item as CloudBlockBlob;\r\n                if (blobFile.Name.Contains(strDate.Substring(0, 10) + \"/\" + strDate.Substring(11)))\r\n                {\r\n                    WebClient webclient = new WebClient();\r\n                    string reply = webclient.DownloadString(ConfigurationManager.AppSettings[\"blobUrl\"] + blobFile.Name.Trim());\r\n\r\n                    FileStructure fileobj=new FileStructure();\r\n                    fileobj.Filecontant = reply;\r\n                    fileobj.Filename  = blobFile.Name.Trim();\r\n                    lts.Add(fileobj);\r\n                    flag = true;\r\n                }\r\n            }\r\n\r\n            foreach (var item in blobList.Where((blobItem, type) => blobItem is CloudBlobDirectory))\r\n            {\r\n                var directory = item as CloudBlobDirectory;\r\n\r\n                if (directory.Prefix.Contains(\"retailapp-triggered-EmailPdfReport\"))\r\n                {\r\n                    sb.AppendLine(indent + directory.Prefix.ToUpper());\r\n                    // Call this method recursively to retrieve subdirectories within the current:\r\n                    sb.AppendLine();\r\n                    if (flag == false)\r\n                    {\r\n                        GetContainerDirectories(directory.ListBlobs(), indent, strDate);\r\n                    }\r\n                }\r\n            }\r\n            // List all additional subdirectories in the current directory, and call recursively:\r\n        }\r\n\r\n        //Get webjob data by date\r\n        [HttpPost]\r\n        public ActionResult GetDataByDate(string strdate) \r\n        {\r\n            if(strdate==\"\")\r\n            {\r\n                return Json(new\r\n                {\r\n                    success = false,\r\n                    responseMsg = \"Please select date first!\"\r\n                });\r\n            }\r\n\r\n            var credentials = new StorageCredentials(\r\n                ConfigurationManager.AppSettings[\"AzureBlobStorageAccountName\"],\r\n                ConfigurationManager.AppSettings[\"AzureBlobStorageAccountKey\"]);\r\n\r\n            var account = new CloudStorageAccount(credentials, true);\r\n\r\n            var client = account.CreateCloudBlobClient();\r\n            WriteAzureDirectoriesToConsole(client.ListContainers(), strdate);\r\n            var list = new List<FileStructure>();\r\n\r\n            foreach (var item in lts)\r\n            {\r\n                var model = new FileStructure();\r\n                model.Filecontant = item.Filecontant;\r\n                model.Filename = item.Filename;\r\n                list.Add(model);\r\n            }\r\n            return Json(new\r\n            {\r\n                success=true,\r\n                List=list\r\n            });\r\n        }\r\n    }\r\n}\r\n`\r\n\r\n\r\nand when I am trying to access that container there is a 409 error.\r\n\r\nLooking forward to hear from you very soon.\r\n\r\nThank you!"},"comment":{"url":"https://api.github.com/repos/Azure/azure-storage-net/issues/comments/363922876","html_url":"https://github.com/Azure/azure-storage-net/issues/572#issuecomment-363922876","issue_url":"https://api.github.com/repos/Azure/azure-storage-net/issues/572","id":363922876,"user":{"login":"erezvani1529","id":7978554,"avatar_url":"https://avatars2.githubusercontent.com/u/7978554?v=4","gravatar_id":"","url":"https://api.github.com/users/erezvani1529","html_url":"https://github.com/erezvani1529","followers_url":"https://api.github.com/users/erezvani1529/followers","following_url":"https://api.github.com/users/erezvani1529/following{/other_user}","gists_url":"https://api.github.com/users/erezvani1529/gists{/gist_id}","starred_url":"https://api.github.com/users/erezvani1529/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erezvani1529/subscriptions","organizations_url":"https://api.github.com/users/erezvani1529/orgs","repos_url":"https://api.github.com/users/erezvani1529/repos","events_url":"https://api.github.com/users/erezvani1529/events{/privacy}","received_events_url":"https://api.github.com/users/erezvani1529/received_events","type":"User","site_admin":false},"created_at":"2018-02-07T21:51:27Z","updated_at":"2018-02-07T21:51:27Z","author_association":"CONTRIBUTOR","body":"Hi @ManishKatoch,\r\n\r\nApologies about the delay in response. Would you please share the full stack trace if you are still experiencing the issue?\r\n\r\nThanks,\r\nElham"}}
{"actor":{"display_login":"erezvani1529"}}