1
votes

I am creating a bot that needs to return a csv file from an azure storage blob as a response (i.e. give me a listing of all users and email addresses). When I run the request in the bot framework emulator it works great, but when trying in teams (which will be used for the chatbot) I get the following error.

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).

Here is the part where I an attaching the file to the message.

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);

Has any one gotten this to work?

UPDATE: This is from the App Studio Editor in teams.

enter image description here

1
Could you please make sure if you have allowed "supportFiles" to true for your Bot?Gousia Begum
Are you sure the "fileUrl" has correct value?rudolf_franek
fileUrl is set to the link for the file in Azure, I have supportFiles set on App Studio app for teams. I've read that there is a place to set it in the manifest, but my program doesn't have a manifest file.JPiasente
Also in Visual Studio 2019, I can't find a place to add the application manifestJPiasente

1 Answers

0
votes

Ok from what I read, only image files can be used as attachments. So I went with sending a hero card to the url. And that seems to work.