Search code examples
windows-store-appswindows-store

Is it possible to save file to desktop? Windows Store


I need a way to download file to desktop.

As per my research I find way to Save a file to an app-specific directory i.e(LocalFolder,RoamingFolder,TemporaryFolder) ,DownloadsFolder and KnownFolders i.e(DocumentsLibrary,PictureLibrary,MusicLibrary,VideoLibrary and RemovableDevices).

C# provide a way to get path to desktop and create file

var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
var fullFileName = Path.Combine(desktopFolder, "Test.txt");
var fs = new FileStream(fullFileName, FileMode.Create);

but there is no SpecialFolder or GetFolderPath exist in class Environment

So my question -

Is it possible to save file to desktop with windows store app? if possible then please let me know how?


Solution

  • No it is not possible in direct way. You must use FolderPicker at least one time and request user to select Desktop folder. Then store that folder in FutureAccessList. Then you can store files in that folder.