Skip to content

Update adaptivecard-send.md#2167

Closed
LuiseFreese wants to merge 2 commits intopnp:mainfrom
LuiseFreese:patch-1
Closed

Update adaptivecard-send.md#2167
LuiseFreese wants to merge 2 commits intopnp:mainfrom
LuiseFreese:patch-1

Conversation

@LuiseFreese
Copy link
Copy Markdown
Contributor

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'.

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'.
@waldekmastykarz
Copy link
Copy Markdown
Member

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?

@LuiseFreese
Copy link
Copy Markdown
Contributor Author

Hey, I tried terminal in Visual Studio Code and was not aware that different shells would behave differently.

@LuiseFreese
Copy link
Copy Markdown
Contributor Author

tried as well in PowerShell, same behavior.

@waldekmastykarz
Copy link
Copy Markdown
Member

What shell are you using in VSCode? Could it be that you have PowerShell set up both in VSCode and in Terminal?

@LuiseFreese
Copy link
Copy Markdown
Contributor Author

yip that's right.

@waldekmastykarz
Copy link
Copy Markdown
Member

Shall we update your PR so that rather than replacing the existing sample, we add a new one for PowerShell?

@LuiseFreese
Copy link
Copy Markdown
Contributor Author

Yip, please do so! Out of curiosity: in which shell did that work?

@waldekmastykarz
Copy link
Copy Markdown
Member

Bash/zsh/fish (*sh) on macOS. Most likely it would also work on *sh on WSL.

@LuiseFreese
Copy link
Copy Markdown
Contributor Author

thank you :)

@waldekmastykarz
Copy link
Copy Markdown
Member

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! 👏

@waldekmastykarz waldekmastykarz marked this pull request as draft February 16, 2021 18:31
updated as discussed with Waldek :-)
@LuiseFreese
Copy link
Copy Markdown
Contributor Author

I did ✅

@LuiseFreese LuiseFreese marked this pull request as ready for review February 17, 2021 09:14
@waldekmastykarz
Copy link
Copy Markdown
Member

Hero! We'll get through it asap 👏

Copy link
Copy Markdown
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 👏


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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the existing samples intact


Send custom card with all known options merged

```sh
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@waldekmastykarz
Copy link
Copy Markdown
Member

Merged manually. Thank you and welcome to the team 👏

@waldekmastykarz waldekmastykarz added this to the v3.6 milestone Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants