locked
Trouble implementing restricted capability (Packages) RRS feed

  • Question

  • So I was following this. I'm building a 'launcher' app that lets the user view and run their installed software. I managed to get this exception. It also throws some problem about getting denied by WinRT.

    Exception: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Windows.Management.Deployment.PackageManager.FindPackages() at launcherproto.MainPage..ctor()

    I see a blue line under Capability that regards to referencing.

    < rescap:Capability Name="packageQuery" />

    Any guess on what I'm doing wrong?

    EDIT: For now I'm not concerned with submitting it to the store, as long as it can be sideloaded I'm happy. 


    David98xp

    Tuesday, December 17, 2019 3:31 AM

All replies

  • Hi,

    From the document PackageManager.FindPackage() Method, you could see that this method requires administrative privileges. But UWP apps don't run as administrator by default. So that's why you got the exception.

    Best regards,

    Roy


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Thursday, December 19, 2019 2:04 AM