How to fix AccessDenied Error when accessing KnownFolders.MediaServerDevices?


I'm trying to build a simple music player for PC / Xbox One that uses DLNA as media sources, but I keep getting an AccessDenied error.

I've imported Windows.Storage, and I've enabled the Music Library capability in the App Manifest. Trying to assign / access KnownFolders.MediaServerDevices throws the AccessDenied error. From this doc, I should only need any of the Music / Picture / Video library dependencies to use MediaServerDevices, but enabling any combination of capabilities doesn't seem to work.

public MainPage()

        StorageFolder MediaServerDevices;
        MediaServerDevices = KnownFolders.MediaServerDevices;

This should assign the StorageFolder to MediaServerDevices, instead it throws:

  Message=Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

How can I fix this error?

asked on Stack Overflow Jul 11, 2019 by mantecademani

1 Answer


MediaServiceDevice folder collects files of the specified type on the current device, not just music library or other multimedia folders. For mobile phones, it works. But for the PC, it involves access to other folders. So it’s not enough to just get the permissions of the music library.

If you want it to work on a PC, you need to get a wider range of file permissions.

Open Package.appxmanifest with code, add the namespace and new Capability:

  IgnorableNamespaces="uap mp rescap">

    <uap:Capability Name="musicLibrary"/>
    <rescap:Capability Name="broadFileSystemAccess"/>


broadFileSystemAccess is the key to access the MediaServiceDevice.

This is a restricted capability. Access is configurable in Settings > Application. Find your application and open the advanced options.

Open File System.

At this time you can access the MediaServiceDevice folder on your PC.

I hope this can help you.

User contributions licensed under CC BY-SA 3.0