附加 CSV 文件以回复 Microsoft Bot Framework for Teams
Attaching CSV file to reply for Microsoft Bot Framework for Teams
我正在创建一个机器人,它需要 return 来自天蓝色存储 blob 的 csv 文件作为响应(即给我所有用户和电子邮件地址的列表)。当我 运行 在 bot 框架模拟器中请求时它工作得很好,但是在团队中尝试时(将用于聊天机器人)我收到以下错误。
Operation returned an invalid status code 'BadRequest' at
Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync(String
conversationId, String activityId, Activity activity, Dictionary2
customHeaders, CancellationToken cancellationToken) at
Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync(IConversations
operations, String conversationId, String activityId, Activity
activity, CancellationToken cancellationToken) at
Microsoft.Bot.Builder.BotFrameworkAdapter.SendActivitiesAsync(ITurnContext
turnContext, Activity[] activities, CancellationToken
cancellationToken) at
Microsoft.Bot.Builder.TurnContext.<>c__DisplayClass25_0.<g__SendActivitiesThroughAdapter|1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at
Microsoft.Bot.Builder.TurnContext.SendActivityAsync(IActivity
activity, CancellationToken cancellationToken).
这是我将文件附加到邮件的部分。
var message = MessageFactory.Text(noOfUsersFoundText, noOfUsersFound, InputHints.IgnoringInput);
message.Attachments.Add(new Attachment
{
Name = fileName,
ContentType = "text/csv",
ContentUrl = fileUrl
});
await stepContext.Context.SendActivityAsync(message, cancellationToken);
有人成功了吗?
更新:这是来自团队中的 App Studio 编辑器。
好的,据我所知,只有图像文件可以用作附件。所以我向 url 发送了一张英雄卡。这似乎有效。
我正在创建一个机器人,它需要 return 来自天蓝色存储 blob 的 csv 文件作为响应(即给我所有用户和电子邮件地址的列表)。当我 运行 在 bot 框架模拟器中请求时它工作得很好,但是在团队中尝试时(将用于聊天机器人)我收到以下错误。
Operation returned an invalid status code 'BadRequest' at Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync(String conversationId, String activityId, Activity activity, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync(IConversations operations, String conversationId, String activityId, Activity activity, CancellationToken cancellationToken) at Microsoft.Bot.Builder.BotFrameworkAdapter.SendActivitiesAsync(ITurnContext turnContext, Activity[] activities, CancellationToken cancellationToken) at Microsoft.Bot.Builder.TurnContext.<>c__DisplayClass25_0.<g__SendActivitiesThroughAdapter|1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.Bot.Builder.TurnContext.SendActivityAsync(IActivity activity, CancellationToken cancellationToken).
这是我将文件附加到邮件的部分。
var message = MessageFactory.Text(noOfUsersFoundText, noOfUsersFound, InputHints.IgnoringInput);
message.Attachments.Add(new Attachment
{
Name = fileName,
ContentType = "text/csv",
ContentUrl = fileUrl
});
await stepContext.Context.SendActivityAsync(message, cancellationToken);
有人成功了吗?
更新:这是来自团队中的 App Studio 编辑器。
好的,据我所知,只有图像文件可以用作附件。所以我向 url 发送了一张英雄卡。这似乎有效。