【问题标题】:TweetSharp SendTweetWithMediaOptions exampleTweetSharp SendTweetWithMediaOptions 示例
【发布时间】:2013-03-17 10:22:54
【问题描述】:

这里有没有人尝试过使用 TweetSharp 用图片发推文?

我尝试了以下方法:

Dictionary<string, Stream> imageDict = new Dictionary<string, Stream>();
imageDict.Add(imagePath, imageStream);
// I'm getting an error with the line below.
// It's saying I have some invalid arguments. :(
status = service.SendTweet(new SendTweetWithMediaOptions() { Status = readerMsg.Message, Images = imageDict });

但最后一行给了我一个无效的参数错误,没有任何有用的理由。

我尝试查看他们的GitHub 页面,但示例仅说明了如何发布简单的短信。

【问题讨论】:

  • 查看此拉取请求的第一部分。github.com/danielcrenna/tweetsharp/pull/65/files 调用 SendTweetWithMedia 而不是 SendTweet 可能是问题所在。此外,字典中的键似乎不是图像路径(无论如何你给它一个Stream)示例将“测试”传递给它。 --HTH
  • 成功了!感谢您指出 SendTweet 错误。创建一个答案,我会接受它。 :)
  • 已发布.. 见下文。 -谢谢-

标签: c# asp.net asp.net-mvc twitter tweetsharp


【解决方案1】:

查看此拉取请求的第一部分:TweetSharp Github

可能是调用SendTweetWithMedia 而不是 SendTweet。

此外,字典中的键似乎不是图像路径(无论如何您都在给它一个 Stream)示例将“测试”传递给它。

--HTH 玩得开心

【讨论】:

    【解决方案2】:

    service.SendTweet()接受SendTweetOptions类型的参数,如果你想发布图片可以使用

    service.SendTweetWithMedia(new SendTweetWithMediaOptions 
    { 
         Status = "message", 
         Images = dictionary 
    }
    );
    

    【讨论】:

      猜你喜欢
      • 2013-03-03
      • 1970-01-01
      • 2012-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-06
      • 2011-09-29
      相关资源
      最近更新 更多