I also thought that using lists was a bit too cumbersome in the old version. You had to use markdown to achieve lists. I decided to simplify it a bit. Let's see how that works, shall we?
Send-TeamsMessage -Verbose -Color DimGray {
New-TeamsSection -Title 'This is 1st section within 1 message' {
New-TeamsFact -Name 'Bold' -Value '**Special GPO**'
New-TeamsFact -Name 'Italic and Bold' -Value '***Other values***'
New-TeamsFact -Name 'Italic' -Value '*2010-10-10*'
}
New-TeamsSection -Title 'This is 2nd section within 1 message' {
New-TeamsFact -Name 'Bold' -Value '**Special GPO**'
New-TeamsFact -Name 'Italic and Bold' -Value '***Other values***'
New-TeamsFact -Name 'Italic' -Value '*2010-10-10*'
New-TeamsFact -Name 'Link example' -Value "[Microsoft](https://www.microsoft.com)"
New-TeamsFact -Name 'Other link example' -Value "[Evotec](https://evotec.xyz) and some **bold** text"
New-TeamsList -Name 'Testing List' {
New-TeamsListItem -Text 'Test 1' -Level 0 -Numbered
New-TeamsListItem -Text 'Test 2' -Level 1 -Numbered
New-TeamsListItem -Text 'Test 3' -Level 1 -Numbered
New-TeamsListItem -Text 'Test 4' -Level 2 -Numbered
New-TeamsListItem -Text 'Test 5' -Level 2 -Numbered
New-TeamsListItem -Text 'Test 6' -Level 2 -Numbered
New-TeamsListItem -Text 'Test 7' -Level 0 -Numbered
New-TeamsListItem -Text 'Test 8' -Level 0 -Numbered
}
New-TeamsList -Name 'Testing List' {
New-TeamsListItem -Text 'Test 1' -Level 0
New-TeamsListItem -Text 'Test 2' -Level 1
New-TeamsListItem -Text 'Test 3' -Level 1
New-TeamsListItem -Text 'Test 4' -Level 2
New-TeamsListItem -Text 'Test 5' -Level 2
New-TeamsListItem -Text 'Test 6' -Level 2
New-TeamsListItem -Text 'Test 7' -Level 0
New-TeamsListItem -Text 'Test 8' -Level 0
}
New-TeamsList -Name 'Testing List' {
New-TeamsListItem -Text 'First ordered list item' -Level 0
New-TeamsListItem -Text 'Another item' -Level 1 -Numbered
New-TeamsListItem -Text 'First ordered list item' -Level 2
New-TeamsListItem -Text 'First ordered list item' -Level 3
New-TeamsListItem -Text 'Unordered sub-list' -Level 0
New-TeamsListItem -Text "Actual numbers don't matter, just that it's a number" -Level 0 -Numbered
New-TeamsListItem -Text 'Ordered sub-list' -Level 1 -Numbered
New-TeamsListItem -Text 'Another entry' -Level 1 -Numbered
New-TeamsListItem -Text 'Another entry' -Level 0 -Numbered
New-TeamsListItem -Text 'Very very long line that I want to show, hellow helow. Very very long line that I want to show, hellow helow. ' -Level 0 -Numbered
}
}
} -Uri $TeamsID -MessageSummary 'Test1' #-MessageText 'Test2' -MessageTitle 'Test1' #
PSTeams uses similar approach to what you've seen in PSWriteHTML. You can mix and match different types of lists however what I noticed that sometimes things don't start properly as they should. If you try to use Level 0 with and without Numbered within same list things will not work correctly.
Send-TeamsMessage -Verbose -Color DimGray {
New-TeamsSection -Title 'This is 2nd section within 1 message' {
New-TeamsList -Name 'Testing List' {
New-TeamsListItem -Text 'First ordered list item' -Level 0
New-TeamsListItem -Text 'Another item' -Level 0 -Numbered
}
}
} -Uri $TeamsID -MessageSummary 'Test1' #-MessageText 'Test2' -MessageTitle 'Test1' #
Body {
"sections": [
{
"title": "This is 2nd section within 1 message",
"facts": [
{
"name": "Testing List",
"value": "- First ordered list item\r1. Another item"
}
]
}
],
"themeColor": "#696969",
"summary": "Test1"
}
As you can see, JSON is correctly built (at least I think so), but for some reason, nesting kicks in. Oh well, don't mix and match lists, and you should be safe, and maybe, sometime in the future, Microsoft will fix this issue.