Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 1.33 KB

useractivitychannel_trygetforwebaccount_1609957344.md

File metadata and controls

39 lines (30 loc) · 1.33 KB
-api-id -api-type
M:Windows.ApplicationModel.UserActivities.UserActivityChannel.TryGetForWebAccount(Windows.Security.Credentials.WebAccount)
winrt method

Windows.ApplicationModel.UserActivities.UserActivityChannel.TryGetForWebAccount

-description

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

-parameters

-param account

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.

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

-see-also

-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
    }
}