Click here to Skip to main content
15,886,519 members

How to get list of files in metro style app

aquant asked:

Open original thread
>Why guys from Microsoft change all upside down after each .net edition? I have tried to do few simples things in new 'metro style' xaml but nothing is simple today. For example I needed to scan a hard disk drive to get list of files. This is very simple task isn't it?

But please tell me why this pretty simple chunk of code doesn't work
XML
using Windows.Storage;
....

async Task AllFilesIwantToGet()
       {
           StorageFolder sf = 
            await StorageFolder.GetFolderFromPathAsync(@"d:\mydocs");


           IReadOnlyList<IStorageItem> list= await sf.GetItemsAsync();


It looks like GetFolderFromPathAsync() never stops and variable sf is null all the time. I was trying to find solution on MSDN but there is nothing that could help.
I thought it's a permission issue but when I use the following code
XML
var sf = await StorageFolder.GetFolderFromPathAsync(KnownFolders.MusicLibrary.Path);


it never ends up too allthough I have added capabilities to MusicLirary.

Sorry for this but after 10 years of programming I feel still like a newbie. This is annoying. Needless to say that Microsoft shots his own foot again.
Tags: C#, .NET (.NET4.5), Application, Metro-design

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900