1

I am not able to send file attachment from a bot to a user in Skype. I am using bot builder version 3.5.0.

Below is my code.

ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
Activity reply = activity.CreateReply("blah");
reply.Attachments = new List();
Attachment attach = new Attachment();

attach.ContentType = "application/pdf";
// I can browse the below URL in browser and access the PDF
attach.ContentUrl = "https://test.azurewebsites.net/Image/Test.pdf";
attach.Name = "Test.pdf";
attach.Content = "Test";
attach.ThumbnailUrl = attach.ContentUrl;
reply.Attachments.Add(attach);
await connector.Conversations.ReplyToActivityAsync(reply);
ndmeiri
  • 4,979
  • 12
  • 37
  • 45
poovarasan
  • 21
  • 2

1 Answers1

1

Aside from the dire need to upgrade your version of botbuilder, there is also a sample for this. please refer to it for further guidance. It is located in the botbuilder-samples repo. in the sample they are constructing the attachments very similar to how you are:

private static Attachment GetInternetAttachment()
{
    return new Attachment
    {
        Name = "BotFrameworkOverview.png",
        ContentType = "image/png",
        ContentUrl = "https://learn.microsoft.com/en-us/bot-framework/media/how-it-works/architecture-resize.png"
    };
}

So this is most likely caused by the very outdated version of botbuilder you are using

D4RKCIDE
  • 3,439
  • 1
  • 18
  • 34