Is there a way to enable calendar option as an input in V4 chat bot C# other than using Adaptive cards?

て烟熏妆下的殇ゞ 提交于 2019-12-02 05:59:07

The short answer is that this feature isn't available. Adaptive Cards are the best route to go for any kind of UI-based date/time picker. And yes, Adaptive Cards are fully supported on Microsoft channels (which includes WebChat), and less so on other channels.

The best option you have would be to use the DateTime Prompt.

There's a lot of different methods with varying complexity to implement this, but the Virtual Assistant Calendar Skill uses it pretty extensively. Its DatePrompt and TimePrompt might be good places to start.

CoreBot also has a DateResolverDialog that may help and is a little easier to understand.


DateTime is pretty complex to work with in chat bots because "Wednesday at 4 o'clock" can mean Wednesday at 4AM or 4PM. The Timex Resolution Sample should provide additional ideas for dealing with this, if you're going with a text-based input.


It's possible that this isn't working for you in WebChat because of your other issue. I just tested the Date and Time inputs for this card and it's working:

{
    "type": "AdaptiveCard",
    "actions": [{
        "type": "Action.Submit",
        "id": "submit",
        "title": "Submit"
    }],
    "body": [
        {
            "type": "Input.Date",
            "id": "date",
            "title": "New Input.Toggle"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "Input.Time",
                    "id": "time",
                    "title": "New Input.Toggle"
                }
            ]
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.0"
}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!