Excel附件在microsoft bot dot net中的内联附件中不起作用

时间:2017-10-14 21:47:23

标签: c# .net botframework

我正在使用Microsoft dot net BOT。我在BOT中发送Inline excel附件时遇到问题。我在我的项目中有excel文件。

我正在获得像“TestBOT.xlsx”这样的唯一链接。但是,如果我点击链接,则不会下载excel。

以下是我的代码。

        var imagePath = HttpContext.Current.Server.MapPath("~/docs/TestBOT.xlsx");
        var imageData = Convert.ToBase64String(File.ReadAllBytes(imagePath));
        return new Attachment
        {
            Name = "TestBOT.xlsx",
            ContentType = "application/vnd.ms-excel",
            ContentUrl = $"data:application/vnd.ms-excel;base64,{imageData}"

        };

提前致谢。

0 个答案:

没有答案