Nicolas HENAUX
Nicolas HENAUX

Reputation: 1686

Create a StorageFile from path Win8.1

I want to manually create a StorageFile from a path, but there is no constructor for a StorageFile.

Is there a simple way to do a thing like this?

StorageFile f = new StorageFile("C:\song.mp3");

Upvotes: 4

Views: 9413

Answers (2)

Nicolas HENAUX
Nicolas HENAUX

Reputation: 1686

StorageFile file = await StorageFile.GetFileFromPathAsync(item.Path);

Upvotes: 12

Raman Sharma
Raman Sharma

Reputation: 4571

You need to use the StorageFile.GetFileFromPathAsync API:

http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefile.getfilefrompathasync.aspx

Upvotes: 4

Related Questions