【问题标题】:webpage isn't getting displayed in Task Module MS Teams网页未显示在任务模块 MS 团队中
【发布时间】:2020-04-22 18:35:07
【问题描述】:

我有一个网页需要在 MS Teams 的任务模块中显示,我使用 bot 框架 v4 开发了一个解决方案。每当我尝试调用任务模块时,都会出现空白屏幕。我还将机器人 URL 添加到有效域列表中。

这是应用清单(为了保密,我更改了 azure 网站链接。)

    "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.5/MicrosoftTeams.schema.json",
    "manifestVersion": "1.5",
    "version": "1.5.0",
    "id": "b7b71f97-2521-4e66-b359-9be61930cbdb",
    "packageName": "net.azurewebsites.myweb",
    "developer": {
        "name": "Tech Mahindra ",
        "websiteUrl": "https://www.techx.com",
        "privacyUrl": "https://www.techx.com/privacy",
        "termsOfUseUrl": "https://www.techx.com/termsofuse"
    },
    "icons": {
        "color": "color.png",
        "outline": "outline.png"
    },
    "name": {
        "short": "techx QT",
        "full": "techx bot"
    },
    "description": {
        "short": "This is techx patient tracker.",
        "full": "This application is still in development and any information shown here is just demonstartion purpose."
    },
    "accentColor": "#8B8B8B",
    "bots": [
        {
            "botId": "3b3f1550-eee6-4c56-91c5-XXXXXXXXX",
            "scopes": [
                "team",
                "personal"
            ],
            "commandLists": [
                {
                    "scopes": [
                        "team"
                    ],
                    "commands": [
                        {
                            "title": "task",
                            "description": "task for testing task module"
                        }
                    ]
                }
            ],
            "supportsFiles": true,
            "isNotificationOnly": false
        }
    ],
    "permissions": [
        "identity",
        "messageTeamMembers"
    ],
    "validDomains": [
        "myweb.azurewebsites.net"
    ]
}```


***WebPage(PFRPDetailsForm.cshtml) code***

   <html>
<head>
    <style>
        body {
            margin: 0;
            padding-left: 4px;
            padding-right: 4px;
        }
    </style>
    <link href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" rel="stylesheet" />
    <link href="https://cdn.datatables.net/responsive/2.1.1/css/responsive.bootstrap.min.css" rel="stylesheet" />
    <link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
    <title>Microsoft Teams Task Module Tester - Custom Form</title>

</head>
<body>
    <script src="@("https://unpkg.com/@microsoft/teams-js@1.6.0/dist/MicrosoftTeams.min.js")"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script>
        microsoftTeams.initialize();

        function validateForm() {

            microsoftTeams.tasks.submitTask("just for demo");
            return true;
        }
    </script>

    <div class="surface theme-light">
            <div class="panel">
                <div class="font-semibold font-title">Patient Registration Form:</div>
                <form method="POST" id="customerForm" onSubmit="return validateForm()">
                    <div style="width:90%; margin:0 auto;">
                        <div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="fname">First Name: </label><input class="form-control input-field" id="fname" type="text"  name="name" tabindex="1" autofocus>
                        <div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="mname">Middle Name: </label><input class="form-control input-field" id="mname" type="text"  name="name" tabindex="1" autofocus>
                        <div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="lname">Last Name: </label><input class="form-control input-field" id="mname" type="text"  name="name" tabindex="1" autofocus>
                        <div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="sex">SEX : </label><input class="form-control input-field" id="fname" type="text" name="name" tabindex="1" autofocus>
                        <div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="nationality">Nationality: </label><input class="form-control input-field" id="fname" type="text"  name="name" tabindex="1" autofocus>
                        <div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="uid">UID: </label><input class="form-control input-field" id="mname" type="text" name="name" tabindex="1" autofocus>
                        <div class="form-group form-field-input" style="margin-bottom: 10px;"></div><label for="email">Email: </label><input class="form-control input-field" id="email" type="email" placeholder="name@email.com" name="email" tabindex="2">
                        <div class="form-group form-field-input" style="margin-bottom: 10px;"></div><label for="favoriteBook">Primary Phone Number: </label><input class="form-control input-field" id="pphonenumber" type="text" placeholder="Phone 1" name="phonenumber" tabindex="3">
                        <div class="form-group form-field-input" style="margin-bottom: 10px;"></div><label for="pw">Secoundary Phone Number: </label><input class="form-control input-field" id="sphonenumber" type="text" placeholder="Phone 2" name="sphonenumber" tabindex="4">
                        <button class="btn button-primary" style="margin-bottom: 10px; margin-top: 10px;" type="submit" tabindex="5">Next</button>
                        <button class="btn button-primary" style="margin-bottom: 10px; margin-top: 10px;" type="submit" tabindex="5">Cancel</button>
                    </div>
                </form>
            </div>
        </div>
</body>
</html>






【问题讨论】:

    标签: botframework microsoft-teams


    【解决方案1】:

    我不知道这是否相关,但这里有一个可能的建议 - 当您从消息传递扩展调用任务模块时,有一个选项可以在那里指定一个域,该域用于此目的。也许该部分需要填写在您的清单中,即使没有实际的消息扩展(“撰写扩展”注册)。看看架构here

    部分如下:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.5/MicrosoftTeams.schema.json",
      ...
      "composeExtensions": [
        {
          "botId": "%MICROSOFT-APP-ID-REGISTERED-WITH-BOT-FRAMEWORK%",
          "canUpdateConfiguration": true,
          "commands": [
            ...
          ],
          "messageHandlers": [
            {
              "type" : "link",
              "value" : {
                "domains" : [
                  "mysite.someplace.com",
                  "othersite.someplace.com"
                ]
              }
            }
          ]
        }
      ],
      "permissions": [
    

    ... ], “有效域”:[ "contoso.com", "mysite.someplace.com", “othersite.someplace.com” ] })

    【讨论】:

    • 我添加了,但问题仍然存在 :(
    • 我已经删除了 .cshtml 页面中的
      标签,并且能够看到所有输入和标签标签。所以,上面的答案是正确的,但我仍然无法理解为什么
      没有渲染所有元素:(
    • 非常感谢@Hilton
    猜你喜欢
    • 2017-02-27
    • 1970-01-01
    • 2016-06-10
    • 1970-01-01
    • 2017-02-11
    • 2022-01-11
    • 2022-10-20
    • 2015-06-07
    • 1970-01-01
    相关资源
    最近更新 更多