PackageCatalog.AddOptionalPackageAsync(String) PackageCatalog.AddOptionalPackageAsync(String) PackageCatalog.AddOptionalPackageAsync(String) PackageCatalog.AddOptionalPackageAsync(String) PackageCatalog.AddOptionalPackageAsync(String) Method

Definition

Adds an optional package to the package catalog.

public : IAsyncOperation<PackageCatalogAddOptionalPackageResult> AddOptionalPackageAsync(Platform::String optionalPackageFamilyName)
IAsyncOperation<PackageCatalogAddOptionalPackageResult> AddOptionalPackageAsync(winrt::hstring optionalPackageFamilyName) const;
public IAsyncOperation<PackageCatalogAddOptionalPackageResult> AddOptionalPackageAsync(String optionalPackageFamilyName)
Public Function AddOptionalPackageAsync(optionalPackageFamilyName As String) As IAsyncOperation(Of PackageCatalogAddOptionalPackageResult)
Windows.ApplicationModel.PackageCatalog.addOptionalPackageAsync(optionalPackageFamilyName).done( /* Your success and error handlers */ );

Parameters

optionalPackageFamilyName
String String String

The package family of the optional package to add to the catalog.

Returns

Additional features and requirements

Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Examples

The example below installs an optional app package based on its app package family name.

var packageCatalog = PackageCatalog.OpenForCurrentPackage();
string familyName = "<Your app package family name>";
Package installedPackage = await packageCatalog.AddOptionalPackageAsync(familyName);

Remarks

This method only works for optional packages in a related set.