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();
button1_Clickdefinitely not needed). - VladD