Trouble implementing restricted capability (Packages)

Dylan Sukha 1 Reputation point
2019-12-05T02:36:07.227+00:00

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?

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Roy Li - MSFT 33,166 Reputation points Microsoft Vendor
    2019-12-05T03:08:16.803+00:00

    Hi,

    Welcome to Microsoft Q&A!

    According to the document: FindPackages(String, String) Method requires administrative privileges. That's why you get the access denied exception.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.