how to get the document library path RRS feed

  • Question

  • i use the codee:

    StorageFolder^ documentsFolder = KnownFolders::DocumentsLibrary; 
        auto fileOperation = documentsFolder->CreateFileAsync(L"sample.txt", CreationCollisionOption::ReplaceExisting); 

    but it cant create the file, and the documentsFolder->Path is null also, how can i get the documents folder path, because i want to create a file to save my private data in my metro style game , thanks a log

    Thursday, February 9, 2012 6:37 AM


  • You are getting the documents library correctly, but your application probably doesn't have access to it. You would need to declare the capability and associate your file type in order to access files in the documents library. You would then have to access it via the StorageFile and not directly by path.

    That said, the documents library is not the right place to store private data. That should be stored in your application's data store. See the Application data documentation and sample.

    For questions like this which aren't related to using DirectX in your Metro style app you will likely find more responses in the Building Metro style apps with C++ forum.


    Thursday, February 9, 2012 6:47 AM