Search code examples
botframeworkmicrosoft-teams

Teams: How to open Task Module from Adaptive Card in desktop app


I am sending an adaptive card to teams with the bot framework. That is working fine. The card should contain an action that opens a task module like explained here.

My code for the card looks like this:

AdaptiveCard card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 3))
        {
            Body = new List<AdaptiveElement>() {
                new AdaptiveTextBlock() {
                    Wrap = true,
                    Text = "test",
                    IsSubtle = false,
                    Size = AdaptiveTextSize.Large,
                    Weight = AdaptiveTextWeight.Bolder
                }
            },
            Actions = new List<AdaptiveAction>() {
                new AdaptiveSubmitAction()
                {
                    Title = "In Teams",
                    DataJson = $"{{\"msteams\":{{\"type\":\"task/fetch\"}},\"Url\":\"{url}\",\"Title\": \"{title}\"}}"
                }
            }
        };

The card is showing in teams, but the button is not working in the desktop client. It is just showing this message in red:

Something went wrong. Please try again.

In the web version the task module is just opening fine. Do I have to change something for the desktop version of teams? Tried to change my code a bit like in this example but that isn't working either.

Update: So I tried the example and it did work one time. After that I had the same error message and no task module is showing. But when I pop out the App in a new window, everything is working fine. So it looks to me like a bug in teams.


Solution

  • I had the same problem with the message “Something went wrong. Try again.", when called Task Module from adaptive card. I installed the bot through a local upload of the manifest, but then I found out that it was also added to the list of applications for our organization, and apparently there was some kind of collision between them. After I uninstalled the application from my desktop Teams and installed it from the application pool - the error disappeared.