Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
A Windows App Action provider can specify that one or more of its actions are currently unavailable. This feature enables scenarios such as requiring a login or subscription before an action is made available to the user.
Set initial availability
You can specify the initial availability status of an app action by providing a value for the isAvailable field in the Action definition JSON file. The value is optional and defaults to true. The following example illustrates the usage of the isAvailable field to make an app action unavailable immediately after installation.
"version": 2,
"actions": [
{
"id": "ToDoList.ToDoActionHandler.AddToList",
"description": "Add item to your to-do list",
"icon": "ms-resource://Files/Assets/LockScreenLogo.png",
"usesGenerativeAI": false,
"isAvailable": false,
...
For more information, see Action definition JSON schema for App Actions on Windows.
Change the availability state at runtime
Register a change in availability state of one or more registered actions with the system by calling ActionRuntime.SetActionAvailability.
void SetActionAvailability(bool actionIsAvailable)
{
using (ActionRuntime runtime = new ActionRuntime())
{
runtime.SetActionAvailability("ExampleActionProvider.SendMessage", actionIsAvailable);
}
}