PackageManager.ProvisionPackageForAllUsersAsync(String) PackageManager.ProvisionPackageForAllUsersAsync(String) PackageManager.ProvisionPackageForAllUsersAsync(String) PackageManager.ProvisionPackageForAllUsersAsync(String) Method

Definition

Enables an app package to be installed for all users on a device.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> ProvisionPackageForAllUsersAsync(Platform::String packageFamilyName)
IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> ProvisionPackageForAllUsersAsync(winrt::hstring packageFamilyName) const;
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> ProvisionPackageForAllUsersAsync(String packageFamilyName)
Public Function ProvisionPackageForAllUsersAsync(packageFamilyName As String) As IAsyncOperationWithProgress(Of DeploymentResultDeploymentProgress)

Parameters

packageFamilyName
String String

The FamilyName of the app package to be installed.

Returns

Additional features and requirements

Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Examples

This example demonstrates adding a staged or existing registered package for all users on a device.

using Windows.Foundation;
using Windows.Management.Deployment;

public void provisionForAllUsers(string inputPackageFamilyName)
{
    var packageManager = new PackageManager();
    var result = packageManager.ProvisionPackageForAllUsersAsync(inputPackageFamilyName).AsTask().Result;
    if (result.ExtendedErrorCode != null)
    {
        System.Console.WriteLine("Error {0} provisioning {1}", result, inputPackageFamilyName);
        throw result.ExtendedErrorCode.HResult;
    }
}

Remarks

To provision a package you must be an administrator. The app package to be provisioned must be staged, and it must be on the system volume.

If the package is already provisioned, this perform a "clean" reprovision. A "clean" reprovision will remove all previous installs of this package so the package will behave as if this were its first installation.

Note

If you are provisioning optional packages, you must specify each optional package individually with its own method call.