I want to get the list of installed uwp application in the desktop.I want to make it within uwp application.Is there any way to achieve this?
-
3Have look at similar question. stackoverflow.com/questions/15448832/…– RudraDec 15, 2016 at 9:11
-
Ya It's getting list of installed package bt while uploading to store it's shows error as "Remove Restricted Capabilities"– Vishnu sDec 29, 2016 at 3:31
-
I want to get list of installed Win32 Application in the System.Is it possible to achieve it in UWP?– Vishnu sDec 29, 2016 at 3:34
-
Please follow the steps below Important section in Special and restricted capabilities to request access to a restricted capability before submitting your app to the store. And for a UWP store app, it can't get list of installed Win32 application.– Jay ZuoDec 29, 2016 at 9:43
1 Answer
We can use PackageManager.FindPackagesForUser(String) method to find all packages installed for for the current user in UWP apps like following:
PackageManager packageManager = new PackageManager();
IEnumerable<Windows.ApplicationModel.Package> packages = packageManager.FindPackagesForUser("");
This method returns an enumerable collection of Package objects. Each Package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location.
But please note that To use this method in a UWP app, we need to declare restricted capability packageQuery
in app's package manifest.
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap mp rescap">
...
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="packageQuery" />
</Capabilities>
</Package>
For more info, please see Special and restricted capabilities.
-
1