New-AMTimeInput
SYNOPSIS
Creates a Time Input element for an Adaptive Card.
SYNTAX
New-AMTimeInput [[-id] <String>] [[-title] <String>] [[-value] <String>] [[-placeholder] <String>]
[[-style] <String>]
DESCRIPTION
The `New-AMTimeInput` function creates an Input.Time element that allows users to select a time value. Time inputs are useful for scheduling, appointment setting, or any scenario where users need to specify a time of day.
The element typically renders as a text field with a time picker interface, though the exact appearance may vary across different Adaptive Card hosts. Note that not all Adaptive Card hosts support time inputs consistently.
EXAMPLES
EXAMPLE 1
# Create a simple time input with default values (current time)
$meetingTime = New-AMTimeInput -Id "meetingStart" -Title "Meeting Start Time:"
Add-AMElement -Card $card -Element $meetingTime
EXAMPLE 2
# Create a time input with a specific default time
$reminderTime = New-AMTimeInput -Id "reminderTime" -Title "Set Reminder For:" `
-Value "14:30" -Placeholder "Select reminder time"
EXAMPLE 3
# Create a time input for a form
$card = New-AMCard -OriginatorId "calendar-app"
$startTime = New-AMTimeInput -Id "startTime" -Title "Start Time:" -Value "09:00" $endTime = New-AMTimeInput -Id "endTime" -Title "End Time:" -Value "17:00"
Add-AMElement -Card $card -Element $startTime Add-AMElement -Card $card -Element $endTime
$submitAction = New-AMSubmitAction -Title "Schedule" -Data @{ action = "createEvent" } Add-AMAction -Card $card -Action $submitAction
PARAMETERS
-id
A unique identifier for the time input element. This ID will be used when the card is submitted to identify the time value selected by the user.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-title
Text label to display above the input field, describing what the time selection is for.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-value
Optional default time value for the input. Should be in 24-hour format (HH:mm). If not specified, defaults to the current time.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: (Get-Date).ToString("HH:mm")
Accept pipeline input: False
Accept wildcard characters: False
-placeholder
Optional text to display when no time has been selected. Default: "Select time"
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: Select time
Accept pipeline input: False
Accept wildcard characters: False
-style
Optional visual style for the input element. Valid values: "default", "expanded" Default: "default"
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: Default
Accept pipeline input: False
Accept wildcard characters: False
INPUTS
None. You cannot pipe input to New-AMTimeInput.
OUTPUTS
System.Collections.Hashtable
Returns a hashtable representing the Input.Time element.
NOTES
- Time inputs in Adaptive Cards:
- Values are typically in 24-hour format (HH:mm).
- The display format may vary based on user locale settings.
- Not all Adaptive Card hosts support all time input features consistently.
- Currently, time inputs are only supported in Outlook on the web.
- A warning is displayed when this function is used to indicate limited support.