PackageManager.RequestAddPackageAsync PackageManager.RequestAddPackageAsync PackageManager.RequestAddPackageAsync PackageManager.RequestAddPackageAsync Method

Definition

Overloads

RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>)

Requests a SmartScreen check and user verification before installing the app package(s).

RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>, IIterable<Uri>)

Requests a SmartScreen check and user verification before installing the app package(s). This method provides a packageUrisToInstall overload to specify external packages to be staged and registered.

RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>)

Requests a SmartScreen check and user verification before installing the app package(s).

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IIterable<Platform::String> optionalPackageFamilyNames, IIterable<Uri> relatedPackageUris)
IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IIterable<winrt::hstring> optionalPackageFamilyNames, IIterable<Uri> relatedPackageUris) const;
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IEnumerable<String> optionalPackageFamilyNames, IEnumerable<Uri> relatedPackageUris)
Public Function RequestAddPackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable(Of Uri), deploymentOptions As DeploymentOptions, targetVolume As PackageVolume, optionalPackageFamilyNames As IEnumerable(Of String), relatedPackageUris As IEnumerable(Of Uri)) As IAsyncOperationWithProgress(Of DeploymentResultDeploymentProgress)

Parameters

packageUri
Uri Uri

The URI of the package to add. The URI must follow the file URI scheme (file://) since the only supported URI schemes are local file paths and local network paths.

dependencyPackageUris
IEnumerable<Uri> IEnumerable<Uri>

The URIs of the dependency packages to add. If there are no dependency packages or if the dependency packages are already registered, this parameter can be null.

deploymentOptions
DeploymentOptions DeploymentOptions

A valid enumeration value from the DeploymentOptions enumeration.

targetVolume
PackageVolume PackageVolume

The volume that the package is installed to.

optionalPackageFamilyNames
IEnumerable<String> IEnumerable<String>

Strings that specify the optional package family names from the main bundle to be staged and registered.

relatedPackageUris
IEnumerable<Uri> IEnumerable<Uri>

The URIs of additional packages in the main bundle that should be staged and registered.

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

The example demonstrates how to use RequestAddPackageAsync in a UWP app by hooking it up to a button click handler. This will invoke the SmartScreen request UI window.

public async void OnInstallNowClicked(object sender, RoutedEventArgs args)
{
    var packageManager = new PackageManager();
    DeploymentOperation result = await packageManager.RequestAddPackageAsync(
            this.currentPackageUri,
            null /*no dependencies*/,
            DeploymentOptions.None,
            null /*stage to default package volume*/,
            null /*no optional packages*/,
            null /*no external packages*/);

    if (result.ExtendedErrorCode != null)
    {
        if (result.ExtendedErrorCode.HResult == 0x80073d01)
        {
            // SmartScreen blocked the app installation.
        }
        else
        {
            // The app installation failed for another reason.
        }
    }
}

RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>, IIterable<Uri>) RequestAddPackageAsync(Uri, IIterable<Uri>, DeploymentOptions, PackageVolume, IIterable<String>, IIterable<Uri>, IIterable<Uri>)

Requests a SmartScreen check and user verification before installing the app package(s). This method provides a packageUrisToInstall overload to specify external packages to be staged and registered.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IIterable<Platform::String> optionalPackageFamilyNames, IIterable<Uri> relatedPackageUris, IIterable<Uri> packageUrisToInstall)
IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IIterable<winrt::hstring> optionalPackageFamilyNames, IIterable<Uri> relatedPackageUris, IIterable<Uri> packageUrisToInstall) const;
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IEnumerable<String> optionalPackageFamilyNames, IEnumerable<Uri> relatedPackageUris, IEnumerable<Uri> packageUrisToInstall)
Public Function RequestAddPackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable(Of Uri), deploymentOptions As DeploymentOptions, targetVolume As PackageVolume, optionalPackageFamilyNames As IEnumerable(Of String), relatedPackageUris As IEnumerable(Of Uri), packageUrisToInstall As IEnumerable(Of Uri)) As IAsyncOperationWithProgress(Of DeploymentResultDeploymentProgress)

Parameters

packageUri
Uri Uri

The URI of the package to add. The URI must follow the file URI scheme (file://) since the only supported URI schemes are local file paths and local network paths.

dependencyPackageUris
IEnumerable<Uri> IEnumerable<Uri>

The URIs of the dependency packages to add. If there are no dependency packages or if the dependency packages are already registered, this parameter can be null.

deploymentOptions
DeploymentOptions DeploymentOptions

A valid enumeration value from the DeploymentOptions enumeration.

targetVolume
PackageVolume PackageVolume

The volume that the package is installed to.

optionalPackageFamilyNames
IEnumerable<String> IEnumerable<String>

Strings that specify the optional package family names from the main bundle to be staged and registered.

relatedPackageUris
IEnumerable<Uri> IEnumerable<Uri>

The URIs of additional packages in the main bundle that should be staged and registered.

packageUrisToInstall
IEnumerable<Uri> IEnumerable<Uri>

A list of other package URIs to be staged and registered. This can contain paths to external packages to be installed.

Returns

Additional features and requirements

Device family
Windows 10, version 1803 (introduced v10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)