wonyh_
wonyh_

Reputation: 141

How to get a file from FolderRelativeId?

Universal Windows Platform API has some restrictions. Also for storage. We can't get file access outside of library (without file picker). So, I used StorageApplicationPermissions.FutureAccessList. I wonder how to open a file with that access.


But anyway, I've found this code: FolderRelativeId which provides a random ID and file name, such as:

6250CF578FDF6C5/Song.mp3

How to use it? Is it for opening a file? Documentation doesn't give some explanations about that.

Upvotes: 1

Views: 92

Answers (1)

mm8
mm8

Reputation: 169420

FutureAccessList is a feature to remember previously opened files or folders:

StorageFile file = await savePicker.PickSaveFileAsync();
if (file != null)
{
    string token = Windows.Storage.AccessCache.StorageApplicationPermissions
        .FutureAccessList.Add(file);  
}

You'll find another example of how to use it here.

Of course, you'll still need a picker and a consent to be able to open the file in the first place. The API doesn't remove or change the restrictions that apply to the UWP sandbox.

Upvotes: 1

Related Questions