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

Cron jobs in Azure: Automation, Scheduler, WebJobs or other solution?
Azure App Service - Issue with upload files via SSL
Bibucket failed to deploy to azure “Failed to acquire content from your repository”
How to pass Body Parameters to Post operation using API Management Action in Logic App?
Azure AD Web App with zombie Login Redirect Loop
External authentication not working when configured in 'Authentication / Authorization' settings of Azure portal
How to iterate through all files in sftp folder in Microsoft Azure Logic App
Set VSO build/release number as Azure application setting
How to increase size of OS disk in Windows Azure using Powershell
Azure - Managed Disks, how to create snapshot
Azure App Service Authentication Multiple Servers / Regions
Is it possible to use Azure CLI to configure deployment to an app service from a Dropbox location?
Cannot export a BACPAC from SQL Azure — ExtAuth_Key10 is not supported in Microsoft Azure SQL Database v12
Azure Portal - AD Group Members only lists first 100 members
Azure IoT hub simple publish-subcribe communication
Request.IsAuthenticated returning false when two applications connecting to Azure AD

Categories

HOME
ffmpeg
sharepoint-2013
copy
graylog2
parse.com
quickblox
android-bluetooth
base
windows-10-desktop
threadpool
scale
servlet-filters
textmatebundles
revitpythonshell
beanstalkd
c-strings
zos
smallbasic
apache-httpcomponents
unsigned-integer
desktop-app-converter
meanjs
shinydashboard
directx-12
google-shared-contacts
seh
haxm
outlook-vba
dwm
chamilo-lms
paypal-rest-sdk
mindstorms
uitabbarcontroller
brainfuck
jpype
codeigniter-hmvc
msysgit
ssms-2012
mrtg
android-gps
replaygain
tpl-dataflow
gpt
android-touch-event
bootstrap-slider
flattr
ocsp
target-platform
mutation
xlform
pakyow
phone-number
esky
base-conversion
stringr
android-print-framework
vraptor
lossless-compression
android-design-library
controlsfx
pkcs#10
asp.net-apicontroller
xsltforms
lightstreamer
preon
parsekit
freemind
libtorrent-rasterbar
pubdate
firebird2.1
webcal
uptime
arbtt
cakephp-2.1
squirrelmail
google-website-optimizer
zmodem
jscience
mkmapviewdelegate
posterous
eclipse-tptp
virtual-server

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