locked
Get "Access is denied" when trying to delete folder in Document library? RRS feed

  • Question

  • Dear all,

    I am writing a Metro App with JavaScript, but encounter a problem that can't delete folders/files in document library.

    I already set the capability in manifest to be able to access files in my document.

    The sample code is like this:

    Windows.Storage.KnownFolders.documentsLibrary.getFolderAsync(FolderPath).then(function (folders) {
                    return folders.deleteAsync().then(function () {
                        folders = null;
                    });
                });

    When trying to run the code, I always got "Access is denied" exception, but it worked well in picture library.

    Does anyone encounter the same problem, or give me any advise?

    Thank you all.

     

    Thursday, January 19, 2012 2:58 AM

Answers

  • Hi Viva,

    The documents folder has special properties preventing you from doing this.  For instance you have to have set in your manifest the file extensions you intend to deal with in the Documents folder.  What are you doing in your application that needs the ability to do file and folder manipulation in the Documents folder?  Perhaps we can discuss a better location like the appdata folder.

    -Jeff


    Jeff Sanders (MSFT)
    Monday, January 23, 2012 4:26 PM
    Moderator