C# 文件附件在Microsoft Bot Emulator中工作,但在Skype中不工作

C# 文件附件在Microsoft Bot Emulator中工作,但在Skype中不工作,c#,botframework,skype-bots,C#,Botframework,Skype Bots,我想使用Microsoft Bot Framework V3和Bot Builder Nuget软件包(3.2.0)向Skype客户端发送附件(.txt) 以下是我创建附件的方式: var replayFile = new Microsoft.Bot.Connector.Attachment(); replayFile.Name = "FileName"; replayFile.Content = "ByteArray"; replayFile.ContentType = "text/plain

我想使用Microsoft Bot Framework V3和Bot Builder Nuget软件包(3.2.0)向Skype客户端发送附件(.txt)

以下是我创建附件的方式:

var replayFile = new Microsoft.Bot.Connector.Attachment();
replayFile.Name = "FileName";
replayFile.Content = "ByteArray";
replayFile.ContentType = "text/plain";
这适用于Bot Emulator(3.0.0.59),但我的skype客户端(7.26.0.101)在Windows 10上只能看到消息的文本,而不能看到附件

我还在outlook.com上试用了Skype的Web UI,也没有附件

在本文件中:

它说:

如果它是一个文件,那么它将只是作为一个链接


这是否意味着使用BotFramework发送文件的唯一方法是通过链接?无法直接发送?但是它是如何使用模拟器工作的呢?

我不知道它为什么在模拟器中工作,但是不支持通过Content属性发送字节数组。 但是,根据和注释,您可以使用base64编码的数据URI发送附件:

byte[] data = GetAttachmentData();
var contentType = "text/plain";
var replayFile = new Microsoft.Bot.Connector.Attachment
{
    Name = "FileName.txt",
    ContentUrl = $"data:{contentType};base64,{Convert.ToBase64String(data)}",
    ContentType = contentType
};

另一方面,您不必指定上载哪种图像。“data:image;base64,…”非常有效。@srichakradhar如果同样的方法不起作用,我认为您必须就堆栈溢出问题单独提出一个问题,可能存在重复