EvotecIT/PSTeams

Show Get-Content is value

neroxyr opened this issue · 3 comments

I have a file that I want to be shown in the value parameter
$CreatedUsers = Get-Content C:\Logs\AAD_creacion_exito.txt | Foreach {"$(($_ -split '\s+',4)[0..0])"}
$Fact12 = New-TeamsFact -Name 'Correos creados' -Value "$CreatedUsers"

The file hasta a mail in each row and when it is shown in Teams its displayed as one line

I don't fully understand but I guess you need to do:

$CreatedUsers = Get-Content C:\Logs\AAD_creacion_exito.txt | Foreach {"$(($_ -split '\s+',4)[0..0])"}
foreach ($User in $CreatedUsers) {
 New-TeamsFact -Name 'Correos creados' -Value "$User"
}

At least I think so, but you haven't given much to go on.

Thanks for your quick reply. It is indeed what I was trying to say.

What I get from $Fact12 when put in the -ActivityDetails $Fact12 it shows me this:

Correos creados | creacion.prueba1 creacion.prueba2 creacion.prueba3 creacion.prueba4 creacion.prueba5.


image

In your script It will show me this:
Correos creados creacion.prueba1
Correos creados creacion.prueba2
Correos creados creacion.prueba3
.....
Is there a way to use the same Fact variable to put in the -ActivityDetails parameter or how do I call it to be present in the New-TeamsSection?

I am not really sure what you're asking. You're mixing a bit too Spanish and English for me. You can use the same data as with anything really. Variables are visible within it's scope.