Windows 8/RT : folder and file access

In a previous article, I described a helper to grant secure access to files and folders.

Take care that having a grant to a folder give rights to use the StorageFolder object, not the StorageFile in it.

If you store file path in that folder, you will have to get a secure access to each of them !

In CBR.RT, I have a function to create books from a folder…and I do the mistake…and in the case below AddFolderAccess must be replaced by AddFileAccess !

async public Task AddAllBook(CatalogViewModel vmCatalog, StorageFolder folder)
        {
            IsDirty = true;

            IReadOnlyList<StorageFile> files = await folder.GetFilesAsync();
            foreach (StorageFile file in files)
            {
                FileHelper.AddFileAccess(file);
                await AddSingleBook(vmCatalog, file);
            }
        }

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s