azure


Listing Files from Azure File Service


I have uploaded files to a folder on my Azure file service account. Now I would like to list those files. When the code reaches this line
FileResultSegment resultSegment = await dir.ListFilesAndDirectoriesSegmentedAsync(token);
It closes. No error is thrown, so I cannot figure out the issue. The full method is below. Has anyone got this to work?
public async void ListFiles()
{
const string clientShare = "clientshare";
const string profileDirectory = "profiledirectory";
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudFileClient fileClient = storageAccount.CreateCloudFileClient();
CloudFileShare share = fileClient.GetShareReference(clientShare);
CloudFileDirectory root = share.GetRootDirectoryReference();
CloudFileDirectory dir = root.GetDirectoryReference(profileDirectory);
if (share.Exists())
{
Console.WriteLine("Share Exists");
}
if (dir.Exists())
{
Console.WriteLine("Profiledirectory Exists");
}
Console.WriteLine("List Files/Directories in root directory");
var results = new List<IListFileItem>();
FileContinuationToken token = null;
try
{
do
{
FileResultSegment resultSegment = await dir.ListFilesAndDirectoriesSegmentedAsync(token);
results.AddRange(resultSegment.Results);
token = resultSegment.ContinuationToken;
}
while (token != null);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadKey();
}
// Print all files/directories listed above
foreach (IListFileItem listItem in results)
{
// listItem type will be CloudFile or CloudFileDirectory
Console.WriteLine("- {0} (type: {1})", listItem.Uri, listItem.GetType());
}
Console.ReadKey();
}

Related Links

Azure scalable architecture design
Looking for clarity on Event Hubs vs Topics in Azure Service Bus
How to provision multiple Azure VMs with DSC
Creating Azure Search
Set the max size of Particular.ServiceControl queue in azure
Update app.config on Azure worker role start up
can nlog configuration be set within azure worker role cloudconfiguration files
App.config transformations for multiple worker roles in Azure
Is it possible for the same worker to listen to 2 different subscriptions for different topics
Authenticating machine using Azure AD
Is there a way to specify a machine key for Azure Websites without specifying it in the web.config?
Windows Puppet Agent does not connect to Puppet Enterprise Master
400 Bad Request with Guzzle from the Microsoft Oauth endpoint
Remote monitoring Azure Products
MS Azure - automatically download the latest ip ranges used by MS Azure Datacenters
Site-to-site VPN on Azure

Categories

HOME
lsf
bootstrap-4
lua
xamarin.forms-listview
stripe-payments
geany
jasypt
classloader
add-in
sql-server-express
development-environment
frequency
command-line-arguments
nanotime
numericupdown
condor
apex
factory-girl
syswow64
org-mode
api-design
servlet-filters
snort
slime
powershell-v2.0
azure-ad-graph-api
wso2cep
confidence-interval
parallax
phonegap-desktop-app
ruamel.yaml
directx-12
breakpoint-sass
panel-data
scom
jtapi
paypal-rest-sdk
runge-kutta
polymer-cli
textangular
syncfusion
distributed-lock
php-deployer
keyboard-maestro
oracle-aq
xbrl
gcc4.8
glfw
kony
g-wan
master-data-management
typesetting
glumpy
configuration-profile
ubuntu-15.04
git-config
webtrends
ckcontainer
sizeof
rsh
insert-update
webpack-hmr
asp.net-webpages
xirr
quasar
ubiquity
crosswalk
kindlegen
tabbar
user-registration
cbc-mode
google-swiffy
iife
llvm-gcc
iscroll4
controlsfx
notifydatasetchanged
ash
pkcs#10
nitrogen
tinkerpop-frames
serverside-javascript
modalpopupextender
preon
shift
neventstore
datadesign
square-cube
ms-access-97
mdi
jetspeed2
having
nstreecontroller
myisam
network-scan
gumstix
newsgroup

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App