How do I access a protected folder?

How to access files in this Apple Mail folder (with or without MBS)? I need to delete a file and nothing happens with the code below. The file names are not even displayed! (they display for any other unprotected folder).

Var f As FolderItem = SpecialFolder.UserLibrary.Child("Mail").Child("V9"). Child("MailData")
if f <> Nil then 
  For Each file As Folderitem In f.Children
        msgbox(file.Name) //for test
        // file.remove
        Catch error As IOException
        If error.ErrorNumber <> 0 Then MessageBox(error.Message)  
      End Try
    end if

Didn’t we discuss this some months ago? You need to tell the user that he needs to give the app full disk access. Like this:

Indeed, that’s what I usually do but the application tends to uncheck itself in the System Preferences when I overwrite it with a more recent version!
In this regard, I would very much like to have your full version working to test whether the application has been added, or not, to have full access to the disk. You only gave me part of the incomplete code (please).

The app needs to be codesigned even in the debugger. The adhoc certificate is not enough.