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
413 stars 41 forks source link

ActivityImageLink image not appearing #7

Closed bodybybuddha closed 5 years ago

bodybybuddha commented 5 years ago

I've hosted a few images in the Files section of the MS Teams channel I'm using with this module. Regardless of jpg or png file extension, nothing seems to appear: image

{edit} I am using the https url for the image. However, if I open the link for the image in a browser, the image appears. Any hints as to what I'm doing wrong? Is there a size limit to the image size, or a specific type of image required?

bodybybuddha commented 5 years ago

Please disregard. I see now that I've been using the ActivityImageLink incorrectly. I had assume that one just needed to provide a URL. I didn't see the images are limited to the builtin ones to the module. Perhaps this could be a module enhancement?

Thanks!

PrzemyslawKlys commented 5 years ago

ActivityImageLink can be anything. ActivityImage can be only a limited set of images. You can see this in Example: https://github.com/EvotecIT/PSTeams/blob/master/Examples/Example.ps1

$Section2 = New-TeamsSection `
    -ActivityTitle "**Przemyslaw Klys**" `
    -ActivitySubtitle "@przemyslawklys - 9/12/2016 at 5:33pm" `
    -ActivityImageLink "https://pbs.twimg.com/profile_images/1017741651584970753/hGsbJo-o_400x400.jpg" `
    -ActivityText "Climate change explained in comic book form by xkcd xkcd.com/1732" `
    -Buttons $Button1 `
    -ActivityDetails $Fact3, $Fact4, $Fact5, $Fact6, $Fact7, $Fact8, $Fact9, $Fact10, $Fact11

My understanding is that the link to the image you're giving may be incorrect. You may need to host it outside of teams or make sure that you can open the image in a browser as a standard user.

ActivityImage indeed has some size issues so be careful. ActiveImageLink doesn't seem to have size limits or I've not met them yet.

bodybybuddha commented 5 years ago

Thanks for the response!

Yes - I discovered this last night once I rolled up my sleeves and got into the the issue some more. I was able to successfully use an image on a CDN network for the images.

The issue I did encounter was when I stored the image on the MS Teams channel's Files section. This is basically a SharePoint list. Even when I opened the associated SharePoint site up for the Teams channel, and place the images in another dedicated list (Site Assets) - I had the same issue. So I'm positive the issue is not your code/implementation at all.

Thanks again for your quick reply! I'll have to be satisfied with CDN/external images for now so I can finish a project. :-)