When I was upgrading azure storage from 1.8 to 4.0.1, the following codes don't work anymore.
var myUri = new Uri(generatedURLwithSAS);
var sasContainer = new CloudBlobContainer(myUri);
var result0 = sasContainer.ListBlobs();
Console.WriteLine(result0);
With storage 4.0.1, the codes throws out Exception:
Exception Type: Microsoft.WindowsAzure.Storage.StorageException
Exception: Value cannot be null.
Parameter name: uriString
Stack Trace:
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.<>c__DisplayClassf.<ListBlobs>b__e(IContinuationToken token)at Microsoft.WindowsAzure.Storage.Core.Util.CommonUtility.<LazyEnumerable>d__0`1.MoveNext()
Exception Type: System.ArgumentNullException
Exception: Value cannot be null.
Parameter name: uriString
Stack Trace:
at System.Uri..ctor(String uriString)
at Microsoft.WindowsAzure.Storage.Blob.Protocol.ListBlobsResponse.<ParseXml>d__0.MoveNext()
at Microsoft.WindowsAzure.Storage.Shared.Protocol.ResponseParsingBase`1.<ParseXmlAndClose>d__6.MoveNext()
at Microsoft.WindowsAzure.Storage.Shared.Protocol.ResponseParsingBase`1.<get_ObjectsToParse>d__0.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.<ListBlobsImpl>b__4a(RESTCommand`1 cmd, HttpWebResponse resp, OperationContext ctx)
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ProcessEndOfRequest[T](ExecutionState`1 executionState)
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
Any idea of how to get it working ?
I know I can use account and accountkey to create credentials to access the container and list blobs, but I would like to know how to do that with only the blob path with SAS.
Any suggestion would be greatly appreciated.