Access Denied when trying to Delete a Folder RRS feed

  • Question

  • Hello, 

    I have an Windows Phone App where I can store news from a webpage. Everything is working right, except that I can't delete the Folder of any news.

    I mean, I have this structure:

    /Local/ADNot/ <- Folder where I have all the news stored.
    /Local/ADNot/nots.wpa <- File where I register all the news downloaded.

    In the folder Nots, I create folders when I download a news with the name "N" and a number from 1 to 100 (N1, N2, N3, N4, N5, etc.)

    On each news (in the UI) I have a "Delete" button, that deletes the news in the register, and, suppose to, deletes the news Folder (N[]). But everytime the app closes with "Access Denied" error when it's trying to delete the New Folder.

    I thought that this error was caused because I created the news before trying to delete it, but I changed the code to avoid of delete the entry in the register and before of try to delete the News, I close the app (full, I mean, holding the Back Button and then pressing on the "X"), open it again, and then trying to delete the news, but I get the same error in the same moment (on await NotFolder.deleteasync())

    Here is my code of the delete button:

    Dim folder As StorageFolder = ApplicationData.Current.LocalFolder
    Dim ADNot As StorageFolder = Await folder.GetFolderAsync("ADNot")
    Dim NotFolder As StorageFolder = Await ADNot.CreateFolderAsync("N" & NotNum, CreationCollisionOption.OpenIfExists)
    Await NotFolder.DeleteAsync(StorageDeleteOption.PermanentDelete)

    *The reason of Creating the folder is to avoid any problem of the register, I mean, that in the register appears the news (and, the UI shows the entry), but actually the folder news is not there anymore. Anyway I tried to change it to getfolderasync and a != Null to avoid the same problem (of a ghost entry), but I got the same error.

    I hope that you can help me. I need to upload this App as soon as possible and I can't upload it with this big bug.

    JuanPablo Zuniga First year student Civil Engineering Universidad Adolfo Ibañez - Chile

    Saturday, September 12, 2015 10:38 PM