New-AMFactSet
New-AMFactSet
SYNOPSIS
Creates a FactSet element for an Adaptive Card.
SYNTAX
1
New-AMFactSet [-Facts] <Array> [-Id <String>] [-Verbose <SwitchParameter>] [-Debug <SwitchParameter>] [-ErrorAction <ActionPreference>] [-WarningAction <ActionPreference>] [-InformationAction <ActionPreference>] [-ProgressAction <ActionPreference>] [-ErrorVariable <String>] [-WarningVariable <String>] [-InformationVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>] [-PipelineVariable <String>] [<CommonParameters>]
DESCRIPTION
The New-AMFactSet
function creates a FactSet element that displays a series of facts (key-value pairs) in a structured, two-column format. FactSets are ideal for displaying property lists, specifications, details, or any information that benefits from a label-value layout.
The FactSet element automatically formats the facts in two columns, with titles in the left column (typically bold) and values in the right column. This layout ensures clarity and organization when presenting structured data.
Facts must be created using the New-AMFact
function before being passed to the -Facts
parameter of this function.
EXAMPLES
EXAMPLE 1
1
2
3
4
5
6
7
8
9
# Create a simple employee information FactSet
$facts = @(
New-AMFact -Title "Employee" -Value "John Doe"
New-AMFact -Title "Department" -Value "Engineering"
New-AMFact -Title "Title" -Value "Senior Developer"
New-AMFact -Title "Start Date" -Value "2020-01-15"
)
$factSet = New-AMFactSet -Facts $facts
Add-AMElement -Card $card -Element $factSet
EXAMPLE 2
1
2
3
4
5
6
7
8
# Create a product specification FactSet with ID
$specs = @(
New-AMFact -Title "Model" -Value "ThinkPad X1"
New-AMFact -Title "Processor" -Value "Intel Core i7"
New-AMFact -Title "Memory" -Value "16 GB"
New-AMFact -Title "Storage" -Value "512 GB SSD"
)
$specSheet = New-AMFactSet -Facts $specs -Id "product-specs"
Example explanation
1
2
3
4
# Add the FactSet to a container
$container = New-AMContainer -Id "spec-container" -Style "emphasis"
Add-AMElement -Card $card -Element $container
Add-AMElement -Card $card -Element $specSheet -ContainerId "spec-container"
EXAMPLE 3
1
2
3
4
5
6
7
8
9
# Create a FactSet for order details
$orderFacts = @(
New-AMFact -Title "Order Number" -Value "ORD-12345"
New-AMFact -Title "Date" -Value (Get-Date -Format "yyyy-MM-dd")
New-AMFact -Title "Status" -Value "**Shipped**"
New-AMFact -Title "Total" -Value "$125.99"
)
$factSet = New-AMFactSet -Facts $orderFacts
Add-AMElement -Card $card -Element $factSet
PARAMETERS
-Facts
An array of fact objects created with New-AMFact
. Each fact represents a key-value pair with a Title (key) and Value.
1
2
3
4
5
6
7
8
9
Type: Array
Parameter Sets: (All)
Aliases: None
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Id
(Optional) A unique identifier for the FactSet. This can be useful when you need to reference this element in other parts of the card or target it with actions.
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
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-AMFactSet
.
OUTPUTS
System.Collections.Hashtable
Returns a hashtable representing the FactSet element.
NOTES
- FactSets are ideal for displaying structured information where clarity and organization are important.
- Best practices for using FactSets:
- Use concise titles that clearly identify the information.
- Group related facts together in a single FactSet.
- For very long lists, consider using multiple FactSets with headers.
- FactSets render differently across different Adaptive Card hosts, so test your cards in the target environment.