UserActivity UserActivity UserActivity UserActivity UserActivity Class


A UserActivity is created by an app during its execution to notify the system of a user work stream that can be continued on another device, or at another time on the same device. It provides information about a task the user is engaged in.

public : sealed class UserActivity
struct winrt::Windows::ApplicationModel::UserActivities::UserActivity
public sealed class UserActivity
Public NotInheritable Class UserActivity
var userActivity = new userActivity(activityId);

Windows 10 requirements

Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)


A UserActivity encapsulates a user's task that can be continued at a later time, and potentially on a different device. Creating a User Activity causes that activity to appear in Windows Timeline and in Cortana's Pick up where I left off feature. Timeline is a rich task view that shows a chronological view of what you’ve been working on. It can also include what you were working on across devices. For example, a mail app could create a UserActivity when the user starts creating a new email message. The user could pause working on the email and then work on it later on the same machine, or even another device.

Version history

Windows version SDK version Value added
1803 17134 UserActivity
1803 17134 ToJson
1803 17134 ToJsonArray
1803 17134 TryParseFromJson
1803 17134 TryParseFromJsonArray
1809 17763 IsRoamable


UserActivity(String) UserActivity(String) UserActivity(String) UserActivity(String) UserActivity(String)

Create a UserActivity with a specified activity ID


ActivationUri ActivationUri ActivationUri ActivationUri ActivationUri

Gets and sets the activation Uniform Resource Identifier (URI).

ActivityId ActivityId ActivityId ActivityId ActivityId

Gets the activity ID that was assigned to this UserActivity when it was created.

ContentInfo ContentInfo ContentInfo ContentInfo ContentInfo

Gets or sets the content information object for this user activity.

ContentType ContentType ContentType ContentType ContentType

Gets and sets the MIME (Multipurpose Internet Mail Extensions) type of the content stored at UserActivity.ContentUri. For example, "text/plain".

ContentUri ContentUri ContentUri ContentUri ContentUri

Gets and sets the content Uniform Resource Identifier (URI) of the content or document that is represented by the UserActivity.

FallbackUri FallbackUri FallbackUri FallbackUri FallbackUri

Gets and sets the fallback Uniform Resource Identifier (URI) to use if there is no handler for the activation URI.

IsRoamable IsRoamable IsRoamable IsRoamable IsRoamable

Gets and sets whether the particular activity's metadata should be uploaded to the Microsoft Cloud.

State State State State State

Gets the state (Published or New) of this UserActivity.

VisualElements VisualElements VisualElements VisualElements VisualElements

Gets information that can be used for the details tile for this activity.


CreateSession() CreateSession() CreateSession() CreateSession() CreateSession()

Creates a UserActivitySession that this user activity will be associated with. You must call this method on the UI thread.

SaveAsync() SaveAsync() SaveAsync() SaveAsync() SaveAsync()

Publish the UserActivity.

ToJson() ToJson() ToJson() ToJson() ToJson()

Serializes the UserActivity into a JSON string. Among other things, the JSON string will contain the App display name, the activation URL, the content URL, content information, and visual element information such as description, background color, and so on.

ToJsonArray(IIterable<UserActivity>) ToJsonArray(IIterable<UserActivity>) ToJsonArray(IIterable<UserActivity>) ToJsonArray(IIterable<UserActivity>) ToJsonArray(IIterable<UserActivity>)

Serializes a collection of UserActivity objects into a JSON string. Among other things, the JSON string will contain the App display name, the activation URL, the content URL, content information, and visual element information such as description, background color, and so on for each UserActivity.

TryParseFromJson(String) TryParseFromJson(String) TryParseFromJson(String) TryParseFromJson(String) TryParseFromJson(String)

Constructs a UserActivity from a JSON string.

TryParseFromJsonArray(String) TryParseFromJsonArray(String) TryParseFromJsonArray(String) TryParseFromJsonArray(String) TryParseFromJsonArray(String)

Creates a collection of UserActivity objects from a JSON string.

See also