EvotecIT / PSTeams

PSTeams is a PowerShell Module working on Windows / Linux and Mac. It allows sending notifications to Microsoft Teams via WebHook Notifications. It's pretty flexible and provides a bunch of options. Initially, it only supported one sort of Team Cards but since version 2.X.X it supports Adaptive Cards, Hero Cards, List Cards, and Thumbnail Cards. All those new cards have their own cmdlets and the old version of creating Teams Cards stays as-is for compatibility reasons.
MIT License
409 stars 41 forks source link

The parameter “ActivityImage” of the “New-TeamsSection” command does not work #22

Closed lingyf closed 4 years ago

lingyf commented 4 years ago

Hello there,

I am using the latest version of the "PSTeams" module and found that the parameter "ActivityImage" of the "New-TeamsSection" command does not work. I checked the source code and found that the "StoredImages" path may not correct, here is a possible solution:

PSTeams.psm1 Line 651-654

if ($ActivityImage -ne 'None') {
-    $StoredImages = [IO.Path]::Combine("$(Split-Path -Path $PSScriptRoot -Parent)", "Images")
+    $StoredImages = [IO.Path]::Combine($PSScriptRoot, "Images")
     $ActivityImageLink = Get-Image -PathToImages $StoredImages -FileName $ActivityImage -FileExtension '.jpg' # -Verbose
}

Best Regards, Albert

PrzemyslawKlys commented 4 years ago

Nah, it's not related to path. I believe it's related to name of the property. It should be ActivityImage

https://github.com/EvotecIT/PSTeams/blob/b09a53aa619a60993bed0718c546ef2606fa22c2/Public/New-TeamsActivityImage.ps1#L12-L13

PrzemyslawKlys commented 4 years ago

Or maybe not. Investigating.

PrzemyslawKlys commented 4 years ago

Changed it to: $StoredImages = [IO.Path]::Combine($PSScriptRoot, '..', 'Images') which is proper way I believe, as the ScriptRoot where the path is checked is. This is the path that is correct for "non" merged resources (before publishing). Now i need to add code to my publishing module to replace it on the fly with proper path.

PrzemyslawKlys commented 4 years ago

Published new version