Share via


UserActivity.ToJsonArray(IIterable<UserActivity>) Method

Definition

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.

public:
 static Platform::String ^ ToJsonArray(IIterable<UserActivity ^> ^ activities);
 static winrt::hstring ToJsonArray(IIterable<UserActivity> const& activities);
public static string ToJsonArray(IEnumerable<UserActivity> activities);
function toJsonArray(activities)
Public Shared Function ToJsonArray (activities As IEnumerable(Of UserActivity)) As String

Parameters

activities

IIterable<UserActivity>

IEnumerable<UserActivity>

The collection of user activities to convert to JSON.

Returns

String

Platform::String

winrt::hstring

A JSON string representing the user activities.

Windows requirements

Device family
Windows 10, version 1803 (introduced in 10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v6.0)

Remarks

A better re-engagement UI can be built within a consuming application if the source application can provide more details about the re-engagement. By serializing the collection of UserActivity objects into a JSON string, you can then store them in a DataPackage and reconstitute them in the consuming application to provide more insight about the source application and the specific activities within the application that sourced the DataPackage.

Applies to

See also

  • <xref:Windows.ApplicationModel.UserActivities.UserActivity.ToJson%0aM%3aWindows.ApplicationModel.UserActivities.UserActivity.TryParseFromJsonArray(System.String)>