StoreContext.GetAppAndOptionalStorePackageUpdatesAsync Method

Definition

Gets the collection of packages for the current app that have updates available for download from the Microsoft Store, including optional packages for the app.

public:
 virtual IAsyncOperation<IVectorView<StorePackageUpdate ^> ^> ^ GetAppAndOptionalStorePackageUpdatesAsync() = GetAppAndOptionalStorePackageUpdatesAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<IVectorView<StorePackageUpdate>> GetAppAndOptionalStorePackageUpdatesAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<IReadOnlyList<StorePackageUpdate>> GetAppAndOptionalStorePackageUpdatesAsync();
function getAppAndOptionalStorePackageUpdatesAsync()
Public Function GetAppAndOptionalStorePackageUpdatesAsync () As IAsyncOperation(Of IReadOnlyList(Of StorePackageUpdate))

Returns

An asynchronous operation that, on successful completion, returns a collection of StorePackageUpdate objects that represent the packages that have updates available.

Attributes

Exceptions

If the ErrorCode property of the exception has the value 0x80070578 (ERROR_INVALID_WINDOW_HANDLE), this indicates that the method was not called on the UI thread. If you are calling this method in a desktop application that uses the Desktop Bridge, this can also indicate that you did not configure the <xref href="Windows.Services.Store.StoreContext?text=StoreContext" /> object to specify which application window is the owner window for modal dialogs shown by this method. For more information, see this article.

The method may throw exceptions when the Microsoft Store service is unavailable or not properly configured. Common scenarios include:- "Object server is stopping when OLE service contacts it": This error typically occurs when the Microsoft Store service is not running, is shutting down, or when there are issues with the Windows Store infrastructure. This can happen if: - The Windows Store app is not installed or is corrupted - The Microsoft Store service is disabled or not running - There are permission issues accessing the Store service - The system is in an inconsistent state during shutdown or startup- Service unavailable errors: Network connectivity issues or Microsoft Store service outages can cause the operation to fail.

Remarks

For more information about using this method, including a code example, see Download and install package updates for your app.

After you call GetAppAndOptionalStorePackageUpdatesAsync to determine which packages have updates available, you can call RequestDownloadStorePackageUpdatesAsync to download the updated packages or you can call RequestDownloadAndInstallStorePackageUpdatesAsync to download and install the updated packages.

Prerequisites and Environment Requirements

For this method to work correctly, the following conditions must be met:

  • Microsoft Store app: The Microsoft Store app must be installed and functional on the system.
  • Microsoft account: While a signed-in Microsoft account is not strictly required to check for updates, certain scenarios may require authentication.
  • Store services: The Microsoft Store licensing and update services must be running and accessible.
  • Network connectivity: An active internet connection is required to communicate with the Microsoft Store service.

Assigned Access Mode Compatibility

This method can be used in Assigned Access (kiosk) mode, but the following considerations apply:

  • The assigned access account must have permission to access Microsoft Store services.
  • Network access must be configured to allow communication with Microsoft Store endpoints.
  • Some Store UI elements may be restricted depending on the assigned access configuration.

Error Handling Recommendations

When calling this method, it's recommended to implement proper error handling:

try
{
    var updates = await storeContext.GetAppAndOptionalStorePackageUpdatesAsync();
    // Process updates
}
catch (System.Runtime.InteropServices.COMException ex)
{
    // Handle COM-related errors (e.g., threading issues)
}
catch (System.Exception ex)
{
    // Handle Store service errors (e.g., service unavailable)
    // Log the error and implement appropriate retry logic
}

Important

Optional packages and downloadable content (DLC) packages are not available to all developer accounts.

Update availability

After you publish an app update in Partner Center, there can be a short delay between when the package passes certification and when the GetAppAndOptionalStorePackageUpdatesAsync method recognizes that the update is available. Most updates become available within a couple hours, but some publishing and distribution steps may take longer to finish in certain cases.

Detection frequency

This API limits how often it checks for new updates. When an app calls the method more frequently than the allowed rate, the method returns the last known status instead of performing a new check.

The current limits are:

  • No more than one check every 30 minutes.
  • No more than ten checks within any 24-hour period.

If an app exceeds these limits, the method continues returning the previous status until the applicable time window passes.

Applies to

See also