Beispiel #1
0
        public async Task <DirectoryTree> GetblobsInContainer(string sasKey)
        {
            CloudBlobContainer    container         = new CloudBlobContainer(new Uri(sasKey));
            BlobContinuationToken continuationToken = null;
            //List<IListBlobItem> blobItems = new List<IListBlobItem>();
            DirectoryTree tree = new DirectoryTree();

            do
            {
                BlobResultSegment blobSegment = await container.ListBlobsSegmentedAsync(continuationToken);

                continuationToken = blobSegment.ContinuationToken;
                foreach (IListBlobItem item in blobSegment.Results)
                {
                    Node newRoot = tree.AddNode(item);
                    if (item is CloudBlobDirectory)
                    {
                        Debug.WriteLine($"{((CloudBlobDirectory)item).Prefix} is a directory");
                        //directories.Add((CloudBlobDirectory)item);
                        await RecursiveFolderSearch(newRoot, (CloudBlobDirectory)item);
                    }
                }
            }while (continuationToken != null);

            {}          return(tree);
        }