locked
How to create Folder outside the App's storage?

    Question

  • Hi,

    I am using following code to create Folder.

    var logUploadFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("LogFileToUpload", CreationCollisionOption.OpenIfExists);
    

    The file-path is too long. Is it create folder outside those? Like bellowing:

    C:\My Documents\MVP

    Thanks and Best Regards,

    Weera

    Friday, September 26, 2014 3:42 PM

Answers

  • Your app cannot arbitrarily access locations outside of its application data. It can get a StorageFolder to other locations by user permission, for example through the FolderPicker or library capabilities.

    In general, the best way to do this is to use the FolderPicker to let the user choose a location the first time it is needed (and then update it through the app's settings). The app can use the AccessCache classes to save the permissions for the folder so it doesn't need the user to pick it on later runs.

    If this is a side-loaded app rather than a store shipped path then you can use the DocumentsLibrary capability to enable the app to get KnownFolders.DocumentsLibrary without the user explicitly choosing it. This capability is a Special use capabilities and not certifiable for general purpose use.

    --Rob

    Friday, September 26, 2014 5:23 PM
    Owner