locked
How i can run pickSingleFolderAsync more than once

    Question

  • Hello

    i need a way to run pickSingleFolderAsync more than once.
    So far, if i try pick more than one folder the function will fail.

    Error: 0x80070005 - access denied

    What i do is simple following. If i pick a folder and run this code for a second time i got the error.

        function showFolderPicker() {
            var folderPicker = new winStorage.Pickers.FolderPicker();
    
            // abort if app is in snapped view
            if ( myUtils.isInSnappedView ) { return };
    
            folderPicker.suggestedStartLocation = winStorage.Pickers.PickerLocationId.computerFolder;
            folderPicker.fileTypeFilter.replaceAll( settings.getAllFilterFileExtensions() );
            folderPicker.viewMode = winStorage.Pickers.PickerViewMode.list;
    
            return folderPicker.pickSingleFolderAsync();
        }


    Greeting
    Silvio


    • Edited by SilvioLi Saturday, December 28, 2013 12:33 AM
    Saturday, December 28, 2013 12:15 AM

Answers

  • it looks the function showFolderPicker gets called while the filePicker is still open. this isnt allowed (want should windows do? open two folder pickers?) make sure the first folderpickers compleets and after that open the second folder picker gets openned

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Saturday, December 28, 2013 10:59 AM
  • Like Dave says, the problem in the other thread was that the original poster was trying to show the picker a second time while the first was still visible. This isn't allowed, and the solution is not to do that. Wait for the first picker to complete before opening a second one.

    You haven't provided enough context to know if this is what you are doing or not, but it sounds likely to be the problem. If you can share a minimal sample project that demonstrates the project we can take a look to confirm.

    --Rob

    Monday, December 30, 2013 6:53 PM
    Moderator

All replies

  • Hi Silvio,

    How are you calling this? Are you waiting for the picker to complete before calling it again? Can you provide a minimal sample that demonstrates the problem?

    I don't have any trouble calling this function multiple times consecutively.

    --Rob

    Saturday, December 28, 2013 12:48 AM
    Moderator
  • Hi Rob,

    i simple call it like other promises. I do this call as a reaction to a click-event of a simple button.
    The first call works fine but the second call results in an error.

    showFolderPicker().then( function complete( folder ) { if ( folder ) { ... } ...
    } );

    UPDATE:
    There is a similar question and in reply to it the question is whether the questioner has called this twice. I dont understand the background of the question for calling the function twice and there is no solution in this thread. : http://social.msdn.microsoft.com/Forums/windowsapps/en-US/ec6c5abe-60a8-44d8-8301-ae3d03c29dac/folder-picker-error?forum=winappswithcsharp

    ---
    Silvio

    • Edited by SilvioLi Saturday, December 28, 2013 1:12 AM UPDATE
    Saturday, December 28, 2013 1:03 AM
  • You cannot pick more that one folder before creating an internal memory which store your folder in it. So I tell you to create one folder list and in package manifest allow those and then you will access multiple folders. :)
    Saturday, December 28, 2013 3:49 AM
  • it looks the function showFolderPicker gets called while the filePicker is still open. this isnt allowed (want should windows do? open two folder pickers?) make sure the first folderpickers compleets and after that open the second folder picker gets openned

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Saturday, December 28, 2013 10:59 AM
  • Like Dave says, the problem in the other thread was that the original poster was trying to show the picker a second time while the first was still visible. This isn't allowed, and the solution is not to do that. Wait for the first picker to complete before opening a second one.

    You haven't provided enough context to know if this is what you are doing or not, but it sounds likely to be the problem. If you can share a minimal sample project that demonstrates the project we can take a look to confirm.

    --Rob

    Monday, December 30, 2013 6:53 PM
    Moderator