我想下載文檔/圖像(文檔/圖像在互聯網上,我正在給它的路徑)。但它不工作..如果我只是評論附件部分,我可以從BOT獲得「Hi」。從使用Microsoft bot框架下載文件(pdf /圖像)
讓我們有這樣
[BotAuthentication]
public class MessagesController : ApiController
{
/// <summary>
/// POST: api/Messages
/// Receive a message from a user and reply to it
/// </summary>
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
Activity reply = activity.CreateReply("Hi");
activity.Attachments.Add(new Attachment()
{
ContentUrl = "https://upload.wikimedia.org/wikipedia/en/a/a6/Bender_Rodriguez.png",
ContentType = "Image/png",
Name = "Bender_Rodriguez.png"
});
await connector.Conversations.ReplyToActivityAsync(reply);
}
}
感謝它工作正常... – Sharad