Share via


AppNotificationButton.InvokeUri Property

Definition

Gets or sets the URI that is launched when the app notification button is clicked.

public:
 property Uri ^ InvokeUri { Uri ^ get(); void set(Uri ^ value); };
Uri InvokeUri();

void InvokeUri(Uri value);
public System.Uri InvokeUri { get; set; }
var uri = appNotificationButton.invokeUri;
appNotificationButton.invokeUri = uri;
Public Property InvokeUri As Uri

Property Value

A Uri object specifying the URI to invoke.

Examples

The following example shows the usage of this property to set the invoke URI for an app notification button.

var button = new AppNotificationButton("Launch URI")
    .AddArgument("action", "info");
button.InvokeUri = new Uri("https://learn.microsoft.com");

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .AddButton(button)
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
    <actions>
        <action content='' arguments='https://learn.microsoft.com/' activationType='protocol'/>
    </actions>
</toast>

Remarks

You can use the URI to launch a web site in the default browser or to launch an app that has a registered URI scheme. For more information on launching apps with URIs see, Launch an app with a URI.

You should set either the invoke URI or the TargetAppId, but not both. If you do set both, the system will use the TargetAppId.

You can also set the invoke URI for an app notification button by calling AppNotificationButton.SetInvokeUri.

For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.

For reference information about the XML schema for app notifications, see App notification content schema.

Applies to