Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Getting a photo from the device to the Camera Roll folder?

dbarrettdbarrett ✭✭✭
edited November 2017 in Questions And Answers

Hello,

I have an app that can take a photo and then it makes a preview of it and then saves the photo to the device using the PhotoCapture class. I can find the photo through the device portal in the file explorer but, how do I get it from there to the camera roll folder that is on the device?

For those curious I have it saved under: UserFiles -> LocalAppData -> AppName -> LocalState

The current file path:

string filePath = Path.Combine(Application.persistentDataPath, filename);

Any suggestions would be appreciated.

AR Developer

Best Answer

  • dbarrettdbarrett ✭✭✭
    edited November 2017 Answer ✓

    I found a solution:

    if WINDOWS_UWP

         filePath = Path.Combine(Windows.Storage.KnownFolders.CameraRoll.Path, filename);   
    

    endif

    You also have to have the PicturesLibrary capability set, I assume this is because you are saving a file to it.

    AR Developer

Answers

  • Hi dbarrett,

    In this current HoloLens version, you can use the filePicker component to access files, however this component only allows you access to the default storage option installed on the given HoloLens. If there is no storage app installed then you can't access it except through the web portal, which is why it's recommended you install a storage option such as OneDrive or Box. When the storage app is installed then the filePicker only supports retrieving files from the storage app installed: OneDrive or Box, and thus you can programmatically retrieve from these locations.

    You also have the choice of streaming which then requires you to use a network request to stream or download the files from some network location.

    Other than that, you're looking at writing some C++ code to try to access files internally which isn't publicly supported.

    Dwight Goins
    CAO & Founder| Independent Architect | Trainer and Consultant | Sr. Enterprise Architect
    MVP | MCT | MCSD | MCPD | SharePoint TS | MS Virtual TS |Windows 8 App Store Developer | Linux Gentoo Geek | Raspberry Pi Owner | Micro .Net Developer | Kinect For Windows Device Developer
    http://dgoins.wordpress.com

  • dbarrettdbarrett ✭✭✭
    edited November 2017

    @Dwight_Goins_EE_MVP Can you share a link to the filePicker documentation?

    I also update my question to more accurately reflect what I am trying to achieve.

    AR Developer

  • dbarrettdbarrett ✭✭✭
    edited November 2017 Answer ✓

    I found a solution:

    if WINDOWS_UWP

         filePath = Path.Combine(Windows.Storage.KnownFolders.CameraRoll.Path, filename);   
    

    endif

    You also have to have the PicturesLibrary capability set, I assume this is because you are saving a file to it.

    AR Developer

Sign In or Register to comment.