nlstack01
nlstack01

Reputation: 839

How to find out whether a string is an AUMID for an installed UWP app?

Is there a .Net library to use to test whether a string is an AUMID for an installed UWP app or not?

An example, if the user enters

Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge

How can I make sure that there actually is a UWP app with this AUMID installed?

Upvotes: 4

Views: 2019

Answers (1)

conio
conio

Reputation: 3718

Well, the AUMID for a UWP has the format FamilyName!AppID, as documented here, for example.

To find out whether a given string is an AUMID for an installed UWP app you have to compare against that. You can build a list of all UWP app AUMIDs and see if the string is one of them, or you can split your string at the exclamation mark, find a package with the given family name, and if the package exists see if it has an application with the given application ID.

The API that does these things is the Windows.Management.Deployment.PackageManager class. Unfortunately, when enumerating the application inside a package, we don't get the application ID. Only in version 10.0.16257.0 of the SDK the Windows.ApplicationModel.Core.AppListEntry class has an AppUserModelId property. Without it seems like you have to look at the package manifest yourself.

It's a lot easier to in PowerShell of course, since it has a cmdlet that get you the package manifest in object form. Microsoft has this example to generate all UWP app AUMIDs:

$installedapps = get-AppxPackage

$aumidList = @()
foreach ($app in $installedapps)
{
    foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
    {
        $aumidList += $app.packagefamilyname + "!" + $id
    }
}

$aumidList

(From: Find the Application User Model ID of an installed app )

Now just see if your string is in the list.

Upvotes: 4

Related Questions