-api-id | -api-type |
---|---|
M:Windows.ApplicationModel.UserActivities.UserActivityChannel.TryGetForWebAccount(Windows.Security.Credentials.WebAccount) |
winrt method |
Get a channel, specific to a specified web account, to use to record user activity.
The web account to associate user activity with.
The channel to use to record user activity. The channel will be associated with the web account.
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.
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
}
}