Hello. I tried a lot of ways: first I tried it on the basis of the paths, then on the basis of the StorageFiles, but I still can’t get access to the files in the folder selected via the FolderPicker. Here is the code, the line in which the write access error occurs at the very end. I have already taken into account some of the nuances of working with the file system and objects, I don’t use any paths at all. Does the FolderPicker and its StorageFolder really not contain StorageFiles with full access to them?

private async void button_Click(object sender, RoutedEventArgs e) { try { FolderPicker _folderPicker = new FolderPicker(); _folderPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder; _folderPicker.ViewMode = PickerViewMode.List; _folderPicker.FileTypeFilter.Add(".mp3"); _folder = await _folderPicker.PickSingleFolderAsync(); if (_folder != null) { StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", _folder); } QueryOptions _queryOptions = new QueryOptions(CommonFileQuery.OrderByName, new[] { ".mp3" }); _queryOptions.FolderDepth = FolderDepth.Deep; var _queryResult = _folder.CreateFileQueryWithOptions(_queryOptions); _filesInFolder = await _queryResult.GetFilesAsync(); foreach (StorageFile _file in _filesInFolder) { _audioList.Add(_file.Name); listView.Items.Add(_file.DisplayName); } } catch (NullReferenceException) { } catch (DirectoryNotFoundException) { } catch (UnauthorizedAccessException) { } listView.SelectedIndex = 0; } private async void listView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (taglist != null) { taglist.Items.Clear(); } _index = listView.SelectedIndex; Stream _fileStreamRead = await _filesInFolder[_index].OpenStreamForReadAsync(); Stream _fileStreamWrite = await _filesInFolder[_index].OpenStreamForWriteAsync(); 
  • I suspect that the piker gives access only to the folder itself, and not to all subfolders. The query with subfolders most likely works only in "libraries". Accordingly, so that the folder can go recursively, you can add it to the music library. - Athari
  • So the fact of the matter is that access to all files is, but only for reading. Stream reading opens to any file. And even you can create your files in any folder inside the selected one. You can delete, copy any files from there. But you cannot open a stream for writing even to the file created by the program. What kind of nonsense? - Morgomirius
  • What are you specifically doing and what is happening? What code is running? If possible, remove all unnecessary from the code (for example, button1_Click definitely not needed). - VladD

0