Embedding Images into New-UDTableColumn

Product: PowerShell Universal
Version: 2

Here is the code so far:


$FMIT = $FMIT | select-object Displayname, Samaccountname, Company, @{l = "Manager"; e = { ($_.Manager -replace 'CN=', '').split(',')[0] } }

                $Colums = @(

                    New-UDTableColumn -Property Image -Title "Image" -Render { 

                        new-udhtml -markup "<img src='https://mysite.us/images/$($_.samaccountname).jpg' width='150' height='150'>"

                    }

                    new-udtablecolumn -property "Company" -title "Company" -Filter -FilterType AutoComplete    

                    new-udtablecolumn -property "DisplayName" -title "Display Name" -Filter -FilterType AutoComplete

                    new-udtablecolumn -property "Samaccountname" -title "User name" -Filter -FilterType AutoComplete

                    new-udtablecolumn -property "Manager" -title "Manager" -Filter -FilterType AutoComplete

                )

                New-UDTable -Data $FMIT -Columns $Colums -sort -export

            }

I am trying to get the first column to show the Image of each user based on the username. I know Iā€™m going about this wrong, please let me know.

The link of the image is .jpg instead of a name.jpg.

Try using $EventData instead.

New-UDTableColumn -Property Image -Title "Image" -Render { 
     new-udhtml -markup "<img src='https://mysite.us/images/$($EventData.samaccountname).jpg' width='150' height='150'>"
}
1 Like

That did it. Thank you. Now I know how to pull data accordingly.

1 Like