I'd like to add formatted comment on a work item with REST API in PowerShell.
I tried this :
$comment = [System.Net.WebUtility]::HtmlEncode(" Here is a new file with relevant information: $DDJ Relevant Information #@$%^&*")
$commentwithmention = "<div><a href="#">@User</a>$comment</div>" #9c48ef54-c54b-6049-98ab-982453ed3e4c
$body = @{
"text" = $commentwithmention
} | ConvertTo-Json
The comment itself worked ! but i can't format the text. I'd like to add formatting, strong and italics on the $DDJ Relevant Information
The HTML balises are not interpreted, event with the HTML encoding.
Is this possible?
In fact, it was the HtmlEncode that caused this. I had some special characters to encode, which is why it happened. (Sorry, I forgot to mention it earlier.) I just removed HtmlEncode and encoded the variable with UTF-8, and it worked.