从Yammer下载附件

时间:2014-07-17 09:48:01

标签: yammer

我正在使用Web客户端下载yammer附件我试图使用yammer API /浏览器提供的所有不同的URL:

- 下载网址 - 大型预览URL - 右键单击​​并复制图像URL

文件以0字节下载

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

下载Yammer附件,您需要下载URl和Access令牌,如下所示

  string Path = @"C:\SocialMediaDownloads\Yammer\Attachments\"+MessageId; 
  bool isExists = System.IO.Directory.Exists(Path);
  if (!isExists)
        System.IO.Directory.CreateDirectory(Path);

        WebClient client = new WebClient();
        client.BaseAddress = "https://www.yammer.com";
        client.Headers["Authorization"] = "Bearer " + accessToken;
        client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadDataCompleted);
        client.DownloadFileAsync(new Uri(URL),Path+@"\"+FileName);
        return Path;
    }
相关问题