Use System.IO.Directory.GetFiles () with your Hololens UWP app

t-kita 61 Reputation points
2022-03-07T05:57:32.503+00:00

I used System.IO.Directory.GetFiles () to browse the 3D Objects folder in Hololens with the Hololens UWP app, but I didn't get any results as shown in the image below.
Can I use System.IO.Directory.GetFiles () in a UWP app?

180409-%E6%A8%A9%E9%99%90%E8%A8%AD%E5%AE%9A%E3%81%AA%E3%81%97%E3%83%86%E3%83%8F%E3%83%83%E3%82%AF%E5%86%85%E5%AE%B9.png

HoloLens | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hernando Ren 2,171 Reputation points
    2022-03-08T07:34:45.773+00:00

    Hello, Welcome to Microsoft Q&A,

    Only the app data locations (such as local, roaming, and temporary) can be directly accessed by some Win32 and COM APIs. To access the rest of the file system, such as the 3D Objects folder, it is recommended to use Windows.Storage broker service which provides rich methods for file operation and additional functions. In your case, to get the files under the Object 3D library, you need to declare capabilities in the app manifest or by calling a file picker to let the user pick files and folders. For more information please see:File access permissions

    ----
    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.