Update adaptivecard-send.md#2167
Conversation
Fixed an issues with escaping JSON in command line in the last two samples. There is also an issue with 'Send a predefined adaptive card with just description' because it returns an error 'Specify either the title or the card to send'.
|
Thanks! Which shell have you used to execute the command? We've been seeing a difference between how to use quotes in the different shells, so perhaps it would be better to create a new sample for the shell that you used rather than replacing the previous one? |
|
Hey, I tried terminal in Visual Studio Code and was not aware that different shells would behave differently. |
|
tried as well in PowerShell, same behavior. |
|
What shell are you using in VSCode? Could it be that you have PowerShell set up both in VSCode and in Terminal? |
|
yip that's right. |
|
Shall we update your PR so that rather than replacing the existing sample, we add a new one for PowerShell? |
|
Yip, please do so! Out of curiosity: in which shell did that work? |
|
Bash/zsh/fish (*sh) on macOS. Most likely it would also work on *sh on WSL. |
|
thank you :) |
|
I'll mark this PR as draft, and when you had a chance to update it like we discussed, please mark it as ready for review so that we'll get it in. Thank you! 👏 |
updated as discussed with Waldek :-)
|
I did ✅ |
|
Hero! We'll get through it asap 👏 |
|
|
||
| If your custom card is a card template (card with placeholders like `${title}`), you can fill it with data either by specifying the complete data object using the `cardData` option, or by passing any number of arbitrary options that will be mapped onto the card. The arbitrary properties should not match any of the global options like `output`, `query`, `debug`, etc. Data options like `title`, `description`, `imageUrl` and `actionUrl` will be mapped onto the card as well. | ||
|
|
||
| Using different shells, we see some differences in how quotes behave, which is why the following examples will work on Bash/zsh/fish (sh) on macOS. See below for examples that will work on Windows Powershell |
There was a problem hiding this comment.
This statement applies to all samples across all of our docs. Rather than mentioning it here specifically, let's start a new discussion to see how we can approach it consistently across all commands. Thank you for bringing it up 👍
| m365 adaptivecard send --url https://contoso.webhook.office.com/webhookb2/892e8ed3-997c-4b6e-8f8a-7f32728a8a87@f7322380-f203-42ff-93e8-66e266f6d2e4/IncomingWebhook/fcc6565ec7a944928bd43d6fc193b258/4f0482d4-b147-4f67-8a61-11f0a5019547 --title "CLI for Microsoft 365 v3.4" | ||
| ``` | ||
|
|
||
| Send a predefined adaptive card with just description |
There was a problem hiding this comment.
Let's keep the existing samples intact
|
|
||
| Send custom card with all known options merged | ||
|
|
||
| ```sh |
There was a problem hiding this comment.
Since these samples are meant for PowerShell, let's mark the code's language as powershell
| ```sh | ||
| m365 adaptivecard send --url https://contoso.webhook.office.com/webhookb2/892e8ed3-997c-4b6e-8f8a-7f32728a8a87@f7322380-f203-42ff-93e8-66e266f6d2e4/IncomingWebhook/fcc6565ec7a944928bd43d6fc193b258/4f0482d4-b147-4f67-8a61-11f0a5019547 --card "{\"type\":\"AdaptiveCard\",\"body\":[{\"type\":\"TextBlock\",\"size\":\"Medium\",\"weight\":\"Bolder\",\"text\":\"${title}\"},{\"type\":\"TextBlock\",\"text\":\"${description}\",\"wrap\":true},{\"type\":\"FactSet\",\"facts\":[{\"$data\":\"${properties}\",\"title\":\"${key}:\",\"value\":\"${value}\"}]}],\"actions\":[{\"type\":\"Action.OpenUrl\",\"title\":\"View\",\"url\":\"${viewUrl}\"}],\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\",\"version\":\"1.2\"}" --cardData "{\"title\":\"Publish Adaptive Card Schema\",\"description\":\"Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.\",\"creator\":{\"name\":\"Matt Hidinger\",\"profileImage\":\"https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg\"},\"createdUtc\":\"2017-02-14T06:08:39Z\",\"viewUrl\":\"https://adaptivecards.io\",\"properties\":[{\"key\":\"Board\",\"value\":\"Adaptive Cards\"},{\"key\":\"List\",\"value\":\"Backlog\"},{\"key\":\"Assigned to\",\"value\":\"Matt Hidinger\"},{\"key\":\"Due date\",\"value\":\"Not set\"}]}" | ||
| ``` | ||
| ## Examples working on Windows PowerShell |
There was a problem hiding this comment.
If I'm not mistaken, the code samples you shared would work with the new cross-platform PowerShell as well, which is named Microsoft PowerShell rather than Windows PowerShell that works just on Windows
|
Merged manually. Thank you and welcome to the team 👏 |
Fixed an issues with escaping JSON in command line in the last two samples. There is also an issue with 'Send a predefined adaptive card with just description' because it returns an error 'Specify either the title or the card to send'.