Get recent activities for a given user.
This OData function has some default behaviors included to make it operate like a 'most recently used' API.
The service queries for the most recent activityHistoryItems, and then pull those related activities.
Activities are sorted according to the most recent lastModified on the activityHistoryItem.
This means that activities without activityHistoryItems won't be included in the response.
The UserActivity.ReadWrite.CreatedByApp permission will also apply extra filtering to the response, so that only activities created by your application are returned.
This server-side filtering might result in empty pages if the user is active and other applications have created more recent activities.
To get your application's activities, use the nextLink property to paginate.
Get recent activities for a given user.
This OData function has some default behaviors included to make it operate like a 'most recently used' API.
The service queries for the most recent activityHistoryItems, and then pull those related activities.
Activities are sorted according to the most recent lastModified on the activityHistoryItem.
This means that activities without activityHistoryItems won't be included in the response.
The UserActivity.ReadWrite.CreatedByApp permission will also apply extra filtering to the response, so that only activities created by your application are returned.
This server-side filtering might result in empty pages if the user is active and other applications have created more recent activities.
To get your application's activities, use the nextLink property to paginate.
Permissions
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
UserActivity.ReadWrite.CreatedByApp,
Delegated (personal Microsoft account)
UserActivity.ReadWrite.CreatedByApp,
Application
Not supported
Examples
Example 1: Code snippet
Import-Module Microsoft.Graph.CrossDeviceExperiences
# A UPN can also be used as -UserId.
Invoke-MgRecentUserActivity -UserId $userId
This example shows how to use the Invoke-MgRecentUserActivity Cmdlet.
Parameters
-Break
Wait for .NET debugger to attach
Parameter properties
Type:
System.Management.Automation.SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Count
Include count of items
Parameter properties
Type:
System.Management.Automation.SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-ExpandProperty
Expand related entities
Parameter properties
Type:
System.String[]
Supports wildcards:
False
DontShow:
False
Aliases:
Expand
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Filter
Filter items by property values
Parameter properties
Type:
System.String
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Headers
Optional headers that will be added to the request.
Parameter properties
Type:
System.Collections.IDictionary
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-HttpPipelineAppend
SendAsync Pipeline Steps to be appended to the front of the pipeline
Credentials for a proxy server to use for the remote call
Parameter properties
Type:
System.Management.Automation.PSCredential
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-ProxyUseDefaultCredentials
Use the default credentials for the proxy
Parameter properties
Type:
System.Management.Automation.SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-ResponseHeadersVariable
Optional Response Headers Variable.
Parameter properties
Type:
System.String
Supports wildcards:
False
DontShow:
False
Aliases:
RHV
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Search
Search items by search phrases
Parameter properties
Type:
System.String
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Skip
Skip the first n items
Parameter properties
Type:
System.Int32
Default value:
0
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Sort
Order items by property values
Parameter properties
Type:
System.String[]
Supports wildcards:
False
DontShow:
False
Aliases:
OrderBy
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Top
Show only the first n items
Parameter properties
Type:
System.Int32
Default value:
0
Supports wildcards:
False
DontShow:
False
Aliases:
Limit
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-UserId
The unique identifier of user
Parameter properties
Type:
System.String
Supports wildcards:
False
DontShow:
False
Parameter sets
Recent
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
To create the parameters described below, construct a hash table containing the appropriate properties.
For information on hash tables, run Get-Help about_Hash_Tables.
INPUTOBJECT <ICrossDeviceExperiencesIdentity>: Identity Parameter
[ActivityHistoryItemId <String>]: The unique identifier of activityHistoryItem
[UserActivityId <String>]: The unique identifier of userActivity
[UserId <String>]: The unique identifier of user