Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PackageUserInformation class

Provides information about the users of an installed package.

Important  You can't use this class in a Windows Store app.
 

Syntax


public sealed class PackageUserInformation

Members

The PackageUserInformation class has these types of members:

Properties

The PackageUserInformation class has these properties.

PropertyAccess typeDescription

InstallState

Read-only

Gets the install state of the package for the user.

UserSecurityId

Read-only

Gets the security identifier (SID) of the package user.

 

Remarks

To enumerate the users who have installed a package, use the PackageManager.FindUsers method.

Examples

Call the PackageManager.FindUsers method to enumerate the users who have installed a package. This example displays the information in the PackageUserInformation.UserSecurityId property.



using System.Security.Principal;

private static void DisplayPackageUsers(
    Windows.Management.Deployment.PackageManager packageManager, 
    Windows.ApplicationModel.Package package)
{
    IEnumerable<Windows.Management.Deployment.PackageUserInformation> packageUsers = 
        packageManager.FindUsers(package.Id.FullName);

    Console.Write("Users: ");

    foreach (var packageUser in packageUsers)
    {
        Console.Write("{0} ", SidToAccountName(packageUser.UserSecurityId));
    }

    Console.WriteLine();
}

private static string SidToAccountName(string sidString)
{
    SecurityIdentifier sid = new SecurityIdentifier(sidString);
    try
    {
        NTAccount account = (NTAccount)sid.Translate(typeof(NTAccount));
        return account.ToString();
    }
    catch (IdentityNotMappedException)
    {
        return sidString;
    }
}

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Management.Deployment
Windows::Management::Deployment [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Minimum supported phone

None supported

Namespace

Windows.Management.Deployment
Windows::Management::Deployment [C++]

Metadata

Windows.winmd

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

See also

Object
Samples
Enumerate app packages sample
Enumerate app packages by name and publisher sample
Concepts
Packaging apps
Reference
PackageManager

 

 

Show: