Reputation: 707
I want to get files and folders from sd from my wp8 pnone. I use the code:
private async void GetFilesAcync()
{
ExternalStorageDevice _sdCard = (await ExternalStorage.GetExternalStorageDevicesAsync()).FirstOrDefault();
if (_sdCard != null)
{
ExternalStorageFolder routesFolder = _sdCard.RootFolder;
IEnumerable<ExternalStorageFolder> folders = await routesFolder.GetFoldersAsync();
IEnumerable<ExternalStorageFile> files = await routesFolder.GetFilesAsync();
foreach (var file in files)
{
names.Add(file.Name);
}
foreach (var folder in folders)
{
names.Add(folder.Name);
}
MessageBox.Show(names.Count.ToString());
mainLLS.ItemsSource = names;
}
}
The problem is that I can see folders, but there are no files (they exist on sd, but don't in IEnumerable<ExternalStorageFile> files
). So, when I launch the code - I can see folders, but no files. I tried to remove code which get folders, and leave only code which have to get files, but there is no result. Is there any way to solve this issue? What I'm doing wrong?
Upvotes: 2
Views: 515
Reputation: 1201
You can only access files of specific types - that is, the file type(s) your application is associated with
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj720573(v=vs.105).aspx
Upvotes: 1