How to enable an app to access the known libraries?

-1

I am creating an app where I need to record videos in C# and save them on the device. To do that i am using

StorageLibrary videos= await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);

However when I run this code, it throws an exception.

System.UnauthorizedAccessException: 'Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))'

. Where can i authorize the app to get the library? I have tried the "Windows Management Instrumentation" but i dont know what to do here. Self, System and Administrators already have permission.

async void Device_IncomingConnectionArrived(object sender, IncomingConnectionEventArgs e)
        {
            e.Accept();
            StorageLibrary myVideos = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);
            //...
        }

Stack trace

SimpleCommunication.exe!SimpleCommunication.CaptureDevice.mediaSink_IncomingConnectionEvent(object sender, object args) Line 53 C#

SimpleCommunication.exe!SimpleCommunication.VideoChat.Device_IncomingConnectionArrived(object sender, Microsoft.Samples.SimpleCommunication.IncomingConnectionEventArgs e) Line 123 C#

c#
visual-studio
async-await
windows-10
storage
asked on Stack Overflow May 30, 2018 by Mediarea • edited May 30, 2018 by Mediarea

1 Answer

1

The problem was, I had not added the capabilities to the video library. At package.appxmanifest file, under Capabilities, select videolibrary.

answered on Stack Overflow May 30, 2018 by Mediarea

User contributions licensed under CC BY-SA 3.0