Jaa


PackageManager.ProvisionPackageForAllUsersAsync Method

Definition

Overloads

ProvisionPackageForAllUsersAsync(String)

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

ProvisionPackageForAllUsersAsync(String, PackageAllUserProvisioningOptions)

Enables an app Package to be installed for all users on a device, including options for specifying additional optional packages to be installed.

ProvisionPackageForAllUsersAsync(String)

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

public:
 virtual IAsyncOperationWithProgress<DeploymentResult ^, DeploymentProgress> ^ ProvisionPackageForAllUsersAsync(Platform::String ^ packageFamilyName) = ProvisionPackageForAllUsersAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> ProvisionPackageForAllUsersAsync(winrt::hstring const& packageFamilyName);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperationWithProgress<DeploymentResult,DeploymentProgress> ProvisionPackageForAllUsersAsync(string packageFamilyName);
function provisionPackageForAllUsersAsync(packageFamilyName)
Public Function ProvisionPackageForAllUsersAsync (packageFamilyName As String) As IAsyncOperationWithProgress(Of DeploymentResult, DeploymentProgress)

Parameters

packageFamilyName
String

Platform::String

winrt::hstring

The FamilyName of the app package to be installed.

Returns

The progress and the result of the app package deployment.

Attributes

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)

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 performs a "clean" reprovision. A "clean" reprovision removes all previous installs of this package, so the package is re-offered to all users that might have previously removed it as if it were its first provision. This doesn't affect any users that currently have the package installed.

Note

If you are provisioning optional packages, you must specify each optional package individually with its own method call. Starting with Windows Build 22000, you can use the overload of ProvisionPackageForAllUsersAsync, to specify additional optional packages to install with a single call.

See also

Applies to

ProvisionPackageForAllUsersAsync(String, PackageAllUserProvisioningOptions)

Enables an app Package to be installed for all users on a device, including options for specifying additional optional packages to be installed.

public:
 virtual IAsyncOperationWithProgress<DeploymentResult ^, DeploymentProgress> ^ ProvisionPackageForAllUsersAsync(Platform::String ^ mainPackageFamilyName, PackageAllUserProvisioningOptions ^ options) = ProvisionPackageForAllUsersAsync;
/// [Windows.Foundation.Metadata.Overload("ProvisionPackageForAllUsersWithOptionsAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> ProvisionPackageForAllUsersAsync(winrt::hstring const& mainPackageFamilyName, PackageAllUserProvisioningOptions const& options);
[Windows.Foundation.Metadata.Overload("ProvisionPackageForAllUsersWithOptionsAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperationWithProgress<DeploymentResult,DeploymentProgress> ProvisionPackageForAllUsersAsync(string mainPackageFamilyName, PackageAllUserProvisioningOptions options);
function provisionPackageForAllUsersAsync(mainPackageFamilyName, options)
Public Function ProvisionPackageForAllUsersAsync (mainPackageFamilyName As String, options As PackageAllUserProvisioningOptions) As IAsyncOperationWithProgress(Of DeploymentResult, DeploymentProgress)

Parameters

mainPackageFamilyName
String

Platform::String

winrt::hstring

The FamilyName of the app package to be installed.

options
PackageAllUserProvisioningOptions

A PackageAllUserProvisioningOptions object specifying the provisioning options.

Returns

The progress and the result of the app package deployment.

Attributes

Windows requirements

Device family
Windows 11 (introduced in 10.0.22000.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v14.0)

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 performs 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.

Applies to