srivi
srivi

Reputation: 19

Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) when retrieving a file in Win 8 App

I am trying to retrieve a file data using C# code

StorageFile pFile = await StorageFile.GetFileFromPathAsync(filepath);

I am getting E_ACCESSDENIED if my path is other than the AppData of my Project. I am working on Visual studio 2012 for Windows 8. Even though files have read/write access and admin rights access, still getting same error.

Can anyone suggest what is going wrong?

Upvotes: 1

Views: 1592

Answers (1)

Martin
Martin

Reputation: 3286

Your app runs in a sandbox. The only location you can access are the app installation path, localappdata and if you have activated the libraries.

Read this msdn article to get all possible file location: MSDN Link

In addition to the default locations, a Windows Store app can access more files and folders by declaring capabilities in the app manifest (see App capability declarations), or by calling a file picker to let the user pick files and folders for the app to access (see Quickstart: Accessing files with file pickers).

Upvotes: 1

Related Questions