UserActivity UserActivity UserActivity UserActivity UserActivity Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

[Contains prerelease APIs.]
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 : IUserActivity
struct winrt::Windows::ApplicationModel::UserActivities::UserActivity : IUserActivity
public sealed class UserActivity : IUserActivity
Public NotInheritable Class UserActivity Implements IUserActivity
var userActivity = new userActivity(activityId);
Attributes
Windows 10 requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Remarks

A UserActivity encapsulates a user's task that can be continued at a later time, and potentially on a different device. 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.

Constructors

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

Prerelease. Create a UserActivity with a specified activity ID

Properties

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 image that will be used to represent the activity on another device.

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.

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.

Methods

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()

Prerelease. 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>)

Prerelease. 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)

Prerelease. Constructs a UserActivity from a JSON string.

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

Prerelease. Creates a collection of UserActivity objects from a JSON string.