locked
StorageApplicationPermissions folder RRS feed

  • Question

  • I have added a folder on disk to the StorageApplicationPermissions for the app I am developing, using the folder picker, what I want to be able to do is load images into a page, the image name and other meta data for the image is stored in a SQLite database as FileName, and the image itself is stored on disk.

    I have tried to set a path to the file in my view model something like this

            public String FileName
            {
                get
                {
                    var f = GetImagePath(this.FilePath);
                    return f.Result;
                }
            }
            private async Task<string> GetImagePath(string imagepath)
            {
                var folder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync("picturefolder");
                return folder.FolderRelativeId + @"\" + imagepath;
            }

    But this isn't working

    Is there a way of referring to this file within the picked folder from a binding in XAML?


    Mal

    Saturday, January 25, 2014 2:39 PM

All replies

  • Hi,

    You can look here: http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.accesscache.aspx

    you can do it :

    StorageFile file = await filePicker.PickSingleFileAsync();
    string token = StorageApplicationPermissions.FutureAccessList.Add(file, metadata”);

    and open it:

    if (StorageApplicationPermissions.FutureAccessList.ContainsItem(folderID))
    {
       StorageFolder folder = 
             await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(folderID);
       ...

    And once the user has picked the StorageFilevwith the file picker the app can cache that access forclater use with the AccessCache classes. You can see  this blog

    The Windows.Storage.AccessCache namespace provides classes to remember StorageItems so they can be reloaded later without requiring the user to go through the picker. The StorageApplicationPermissions.FutureAccessList provides random access to items that have been previously used. The MostRecentlyUsedList allows keeping a list of recently used locations. See How to track recently used files and folders and the File picker sample and the File access sample).

    Best Wishes


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, January 27, 2014 7:59 AM
  • Hi,

    You can look here: http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.accesscache.aspx

    you can do it :

    StorageFile file = await filePicker.PickSingleFileAsync();
    string token = StorageApplicationPermissions.FutureAccessList.Add(file, “metadata”);

    and open it:

    if (StorageApplicationPermissions.FutureAccessList.ContainsItem(folderID))
    {
       StorageFolder folder = 
             await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(folderID);
       ...

    And once the user has picked the StorageFilevwith the file picker the app can cache that access forclater use with the AccessCache classes. You can see  this blog

    The Windows.Storage.AccessCache namespace provides classes to remember StorageItems so they can be reloaded later without requiring the user to go through the picker. The StorageApplicationPermissions.FutureAccessList provides random access to items that have been previously used. The MostRecentlyUsedList allows keeping a list of recently used locations. See How to track recently used files and folders and the File picker sample and the File access sample).

    Best Wishes


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thanks, yes I had got this far, perhaps I should have said, I want to store the path to the file into a SQLite database then use this later, this is where I am having problems because no matter what I store in the database it doesn't seem to work when I try to bind to it later.


    Mal

    Monday, January 27, 2014 8:19 AM
  • Just realised where I might be going wrong, is it the ID I should be storing and not the path?

    Mal

    Monday, January 27, 2014 8:22 AM