如何使用tweetID使用tweetsharp在推文上转发转推

时间:2015-06-26 13:15:55

标签: tweetsharp

我目前正在使用TweetSharp将公共时间线引入我的网络应用程序。

一切正常,但我似乎没有收到我发布的任何转推。

有没有办法让我转发?

以下是我目前用来提取推文的代码片段。

2 个答案:

答案 0 :(得分:0)

使用TweetSharp

TwitterService service = new TwitterService(ConsumerKey, ConsumerSecret);
service.AuthenticateWith(AccessToken, TokenSecret);
var retweetsForeachPost = service.Retweets(new RetweetsOptions { Count = 150, Id = tweetID});

答案 1 :(得分:0)

 public TwitterService oTwitterService = null;
 private void RetweetCmnts(TwitterStatus twitterStatus , TwitterResponse response) {
      TwitterStatues = new TwitterStatus();
      TwitterStatues = twitterStatus;
      }
    case TwitterOptions.ReTweet: {
                if(!string.IsNullOrEmpty(oTimeLineData.UserId) && oTimeLineData.UserId.Length > 0) {
                  TwitterStatus ost = new TwitterStatus();
                  RetweetOptions retweetOptions = new RetweetOptions { Id = Convert.ToInt64(oTimeLineData.Id) , TrimUser = true };
                  Action<TwitterStatus , TwitterResponse> action = RetweetCmnts;
                  action(new TwitterStatus() { Id = Convert.ToInt64(oTimeLineData.Id) , Text = oTimeLineData.TweetedText , InReplyToScreenName = oTimeLineData.ScreenName , InReplyToUserId = Convert.ToInt64(oTimeLineData.UserId) } , null);
                  oTwitterService.Retweet(retweetOptions);
                  if(oTwitterService.Response.StatusCode == HttpStatusCode.OK)
                    _wasSuccessfull = true;
                  else {
                    _twitterError = new TwitterError();
                    TwitterResponeError = GetTwitterErrors(_twitterError , "ReTweet");
                    }
                  }
                break;
                }