locked
Write Files in Known Folders(PicturesLibrary,Music Library,ETC..) in Wp8.1? RRS feed

  • Question

  • Hi All,

    Am Developing WP8.1 App.

    I need to write few files in Pictures library,

    I gave permission in Capabilities.

    But still am getting access Denied Error.

    If i try to write the same file in local folder i can write without any error.

    Am Using Below code to create file.

     file = await Windows.Storage.KnownFolders.PicturesLibrary.CreateFileAsync(fileName, Windows.Storage.CreationCollisionOption.ReplaceExisting);
    Any suggestion would be of great help.

    Thanks

    Arjun.M


    Arjun

    Wednesday, February 4, 2015 12:06 PM

Answers

  • For a WP8.1 silverlight app, there's a need to add capabilities in both WMAppManifest(ID_CAP_MEDIALIB_PHOTO) as well as in package.appxmanifest(Capability Nam = "picturesLibrary")

    Secondly the access denied error only comes up while testing it on emulator, if i install the same app on device then the line PicturesLibrary.CreateFileAsync is executed successfully.

    For a WP8.1 Runtime app, the code works well on both emulator as well as on device.


    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

    Thursday, February 5, 2015 9:28 AM

All replies

  • So you already added this capability to package.appxmanifest file:
    <Capabilities>
     <Capability Name="picturesLibrary" />
    </Capabilities>

    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

    Wednesday, February 4, 2015 12:15 PM
  • Hi Vinnet,

    Thanks for your reply 

    <Capabilities>
     <Capability Name="picturesLibrary" />
    </Capabilities>

    I have already added this capabilities .

    But am getting access denied error


    Arjun

    Thursday, February 5, 2015 7:48 AM
  • For a WP8.1 silverlight app, there's a need to add capabilities in both WMAppManifest(ID_CAP_MEDIALIB_PHOTO) as well as in package.appxmanifest(Capability Nam = "picturesLibrary")

    Secondly the access denied error only comes up while testing it on emulator, if i install the same app on device then the line PicturesLibrary.CreateFileAsync is executed successfully.

    For a WP8.1 Runtime app, the code works well on both emulator as well as on device.


    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

    Thursday, February 5, 2015 9:28 AM