Invoke-MtGraphRequest
SYNOPSIS
Enhanced version of Invoke-MgGraphRequest that supports paging, batching and caching.
SYNTAX
Invoke-MtGraphRequest [-RelativeUri] <String[]> [-UniqueId <String[]>] [-Select <String[]>] [-Filter <String>]
[-QueryParameters <Hashtable>] [-ApiVersion <String>] [-ConsistencyLevel <String>] [-DisablePaging]
[-DisableBatching] [-BatchSize <Int32>] [-GraphBaseUri <Uri>] [-DisableCache] [-OutputType <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
The version of Invoke-Graph request supports
- Filter, Select and Unique IDs as parameters
- Automatic paging if Graph returns a nextLink
- Batching of requests to Graph if multiple requests are piped through
- Caching of results for the duration of the session
- Ability to skip cache and go directly to Graph
- Specify consistency level as a parameter
Note: Batch requests don't support caching.
EXAMPLES
EXAMPLE 1
Invoke-MtGraph -RelativeUri "users" -Filter "displayName eq 'John Doe'" -Select "displayName" -Top 10
Get all users with a display name of "John Doe" and return the first 10 results.
PARAMETERS
-RelativeUri
Graph endpoint such as "users".
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-UniqueId
Specifies unique Id(s) for the URI endpoint. For example, users endpoint accepts Id or UPN.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Select
Filters properties (columns).
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Filter
Filters results (rows). https://docs.microsoft.com/en-us/graph/query-parameters#filter-parameter
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-QueryParameters
Parameters such as "$top".
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ApiVersion
API Version.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: V1.0
Accept pipeline input: False
Accept wildcard characters: False
-ConsistencyLevel
Specifies consistency level.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Eventual
Accept pipeline input: False
Accept wildcard characters: False
-DisablePaging
Only return first page of results.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-DisableBatching
Force individual requests to MS Graph.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-BatchSize
Specify Batch size.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 20
Accept pipeline input: False
Accept wildcard characters: False
-GraphBaseUri
Base URL for Microsoft Graph API.
Type: Uri
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-DisableCache
Specify if this request should skip cache and go directly to Graph.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-OutputType
Specify the output type
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: PSObject
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.