【问题标题】:Download file uploaded on slack下载在 slack 上上传的文件
【发布时间】:2016-03-22 06:42:57
【问题描述】:

我创建了一个 .Net Web API,它可以获取上传到特定 Slack 频道的文件对象/文件详细信息。

我的网址是:

"url_private":"https://files.slack.com/***.png",
"url_private_download":"https://files.slack.com/files-pri/***",
"thumb_64":"https://files.slack.com/files-tmb/***.png",
"thumb_80":"https://files.slack.com/files-tmb/****.png",
"thumb_360":"https://files.slack.com/files-tmb/***.png",
"thumb_360_w":360,
"thumb_360_h":360,
"thumb_160":"https://files.slack.com/files-tmb/***",
"image_exif_rotation":1,
"original_w":400,
"original_h":400,
"permalink":"https://laitkor.slack.com/files/*****/******/***.png",
"permalink_public":"https://slack-files.com/****"

如何从代码中下载该文件并保存在特定文件夹中。 我已经读到我们需要添加授权:Bearer A_VALID_TOKEN,我也做了同样的事情:

   client.Headers["Authorization"] = "Bearer " + "********";
   client.DownloadFile(new Uri("*****"),HttpContext.Current.Server.MapPath("~/Images/" + "AttachmentFile_" + (DateTime.Now.ToString("MM-dd-yy")).Replace("-", "_") + System.Guid.NewGuid().ToString() + ".jpg"));

但是这里不是下载文件,而是下载整个页面代码,当它是一个 txt 文件和损坏的文件时,它是一个图像文件。

请指导我做错了什么。

【问题讨论】:

    标签: c# slack-api slack


    【解决方案1】:

    好吧,我发现我做错了什么。

    我提供的身份验证令牌错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-25
      • 2017-03-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多