Share via


UserActivityChannel.TryGetForWebAccount(WebAccount) Method

Definition

Get a channel, specific to a specified web account, to use to record user activity.

public:
 static UserActivityChannel ^ TryGetForWebAccount(WebAccount ^ account);
 static UserActivityChannel TryGetForWebAccount(WebAccount const& account);
public static UserActivityChannel TryGetForWebAccount(WebAccount account);
function tryGetForWebAccount(account)
Public Shared Function TryGetForWebAccount (account As WebAccount) As UserActivityChannel

Parameters

account
WebAccount

The web account to associate user activity with.

Returns

The channel to use to record user activity. The channel will be associated with the web account.

Windows requirements

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

Examples

private static UserActivityChannel _currentChannel;

public static void UpdateActivityChannelForAccount(WebAccount account)
{
    _currentChannel = UserActivityChannel.TryGetForWebAccount(account);
    if (_currentChannel != null)
    {
        // app-specific – generate activity that will be associated with the web account
    }
}

Remarks

Some apps, such as Mail, support multiple user accounts within a single instance of the app. If the user has a Microsoft Account (MSA) and an Azure Active Directory account (AAD), the app can choose to write to the activity feed associated with the MSA account or the AAD account.

Applies to