Click here to Skip to main content
12,997,469 members (61,270 online)

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
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
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


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.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100