i’m trying to create a newfolder in documentlibrary and using FileOpenPicker to choose multiple images to save the createfolder…
The error is:’System.Collections.Generic.IReadOnlyList’ does not contain a definition for ‘CopyAsync’ and no extension method ‘CopyAsync’ accepting a first argument of type ‘System.Collections.Generic.IReadOnlyList’ could be found (are you missing a using directive or an assembly reference?)
This is my code:
IReadOnlyList<StorageFile> file;
var destinationFolder = await KnownFolders.DocumentsLibrary.CreateFolderAsync("NewFolder", CreationCollisionOption.GenerateUniqueName);
var openpicker = new FileOpenPicker();
openpicker.CommitButtonText = "Upload";
openpicker.FileTypeFilter.Add(".jpg");
openpicker.FileTypeFilter.Add(".jpeg");
openpicker.FileTypeFilter.Add(".png");
openpicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openpicker.ViewMode = PickerViewMode.List;
file = await openpicker.PickMultipleFilesAsync();
if (destinationFolder != null && file !=null)
{
await file.CopyAsync(destinationFolder);
}
when you use PickMultipleFilesAsync you get a list of files instead of one file, so you need to iterate the list to save every file.