i'm getting some problem to get a specific row from a powershell body. HR team send email to us, a logic app get the body of email and pass it to a script that disable the user.
The body is like this:
Hi,
the following user have to be dismiss:
#mail: [email protected]
#mail: [email protected]
#mail: [email protected]
Bye
hr team
[email protected]
i would like to get only the specific row:
#mail: [email protected]
#mail: [email protected]
#mail: [email protected]
to do this i did a trick with following code:
$Body
$SplitBody = $Body.split("").split(" ").Split("#")
$objetbody = $SplitBody.Replace(" ","").Trim()
and i got following result:
Hi,
the
following
user
have
to
be
dismiss:
mail:
[email protected]
mail:
[email protected]
mail:
[email protected]
Bye
hr
team
[email protected]
after that i pass $objetbody into a foreach and loop all row(at the end of this foreach is put a break becouse it can disable HR mail). The flow work if HR sent only 1 mail to disable.
My question is there is a way to got that specific row that contains the mails?
Thanks