如何使用TweetSharp获取我的直接消息?

时间:2016-05-26 15:59:51

标签: c# twitter tweetsharp

如何使用TweetSharp获取直接消息?

我试过了:

var twitterApp = new TwitterService(OAuthConsumerKey, OAuthConsumerSecret);

twitterApp.AuthenticateWith(OAuthToken, OAuthTokeySecret);
TwitterUser user = twitterApp.VerifyCredentials(new VerifyCredentialsOptions());
IEnumerable<TwitterDirectMessage> message = twitterApp.ListDirectMessagesReceived(new ListDirectMessagesReceivedOptions();

它给我null。

1 个答案:

答案 0 :(得分:0)

首先,您必须更改权限,从&#34;读取和写入&#34; to&#34;读取,写入和访问直接消息&#34;

其次,您必须重新生成消费者密钥和密钥,访问令牌和令牌密钥并在您的应用中更改其值

第三,我建议使用 TwitterService

TwitterService service = new TwitterService(customerKey,customerKeySecret, accessToken, accessTokenSecret); 

var directMessagesList = service.ListDirectMessagesReceived(new ListDirectMessagesReceivedOptions { Count = 200});