Bot Builder SDK 4如何使用附件?

时间:2018-12-03 07:47:25

标签: c# .net botframework

Bot Builder SDK 4(dotnet)如何使用附件?我尝试使用BotBuilder-Samples 15.handling-attachments的示例,但在Skype频道上出现401未经授权错误。

foreach (var file in activity.Attachments)
{
    // Determine where the file is hosted.
    var remoteFileUrl = file.ContentUrl;

    // Save the attachment to the system temp directory.
    var localFileName = Path.Combine(Path.GetTempPath(), file.Name)

    // Download the actual attachment
    using (var webClient = new WebClient())
    {
        webClient.DownloadFile(remoteFileUrl, localFileName); <-- 401 here
    }

1 个答案:

答案 0 :(得分:0)

我在github.com讨论Skype Can not receive attachment? #3623上发现了解决方案,我也刚刚对其进行了成功测试。

我看到对您的代码示例的最小修改如下:

3838