Share via


UserActivityRequest.SetUserActivity(UserActivity) Method

Definition

Sets the UserActivity to return when the UserActivityRequested event is raised.

public:
 virtual void SetUserActivity(UserActivity ^ activity) = SetUserActivity;
void SetUserActivity(UserActivity const& activity);
public void SetUserActivity(UserActivity activity);
function setUserActivity(activity)
Public Sub SetUserActivity (activity As UserActivity)

Parameters

activity
UserActivity

The user activity to store.

Examples

private async void UserActivityRequested(
    Windows.ApplicationModel.UserActivities.UserActivityRequestManager sender,
    Windows.ApplicationModel.UserActivities.UserActivityRequestedEventArgs args)
{
    UserActivity userActivity = // app code to create a userActivity
    args.Request.SetUserActivity(userActivity);
}

Remarks

UserActivity.ActivationUri and UserActivity.VisualElements.DisplayText must be set or this method will fail.

Applies to