List all files in a SpecialFolder

I am trying to list all the files in the folder passed as a parameter
but “f” (FolderItem) always returns Nil, did I make a mistake?

Var f As New FolderItem
f = SpecialFolder.ApplicationData.Child("").Child("")
if f <> Nil then 
  For Each file As Folderitem In f.Children
    if file<> Nil and file.Name.Left(10) = ""then
        msgbox(file.Name) //for test
    end if
end if

That means one of the above is Nil…

Decompose the line in multiples lines:

f = SpecialFolder.ApplicationData
If f <> Nil Then
f = f.Child("")
If f <> Nil Then
End If
End IF

and in the debugger follow the program (look where the Nil is…

Even using your original code, f is not nil and f.exists = true on my machine
But have you checked that these folders exist on your machine, and is your app running sandboxed without permission to read there?

Yes you are right, with me too f <> nil, problem comes from the loop on it, nothing happens! (the msgbox is not executed)

For Each file As Folderitem In f.Children

f is not readable by you under normal circumstances.
(on my machine there are 36 child records but they cant be read)

Maybe you can beef up permissions by adding file access?

Thanks @Jeff_Tullin
When i replace my Folderitem (f = SpecialFolder.ApplicationData.Child(etc…) by a “ShowSelectFolderDialog” and i going to the same folder, It works well !

f = FolderItem.ShowSelectFolderDialog

Could it be a FolderItem problem with PathModes.Native … for example?

I found !!!

Var f As New FolderItem("", FolderItem.PathModes.Native)

Apple playing Nanny again, I suspect