New-AMTimeInput

New-AMTimeInput

New-AMTimeInput

SYNOPSIS

Creates a Time Input element for an Adaptive Card.

SYNTAX

1
New-AMTimeInput [-id <String>] [-title <String>] [-value <String>] [-placeholder <String>] [-style <String>] [<CommonParameters>]

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

1
2
3
# 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

1
2
3
# 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

1
2
# Create a time input for a form
$card = New-AMCard -OriginatorId "calendar-app"

Example explanation

1
2
3
4
5
6
7
8
$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.

1
2
3
4
5
6
7
8
9
Type: String
Parameter Sets: (All)
Aliases: None

Required: False
Position: 0
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.

1
2
3
4
5
6
7
8
9
Type: String
Parameter Sets: (All)
Aliases: None

Required: False
Position: 1
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.

1
2
3
4
5
6
7
8
9
Type: String
Parameter Sets: (All)
Aliases: None

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-placeholder

Optional text to display when no time has been selected. Default: “Select time”

1
2
3
4
5
6
7
8
9
Type: String
Parameter Sets: (All)
Aliases: None

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-style

Optional visual style for the input element. Valid values: “default”, “expanded” Default: “default”

1
2
3
4
5
6
7
8
9
Type: String
Parameter Sets: (All)
Aliases: None

Required: False
Position: 4
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.

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.