如何使用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。
答案 0 :(得分:0)
首先,您必须更改权限,从&#34;读取和写入&#34; to&#34;读取,写入和访问直接消息&#34;
其次,您必须重新生成消费者密钥和密钥,访问令牌和令牌密钥并在您的应用中更改其值
第三,我建议使用 TwitterService
类TwitterService service = new TwitterService(customerKey,customerKeySecret, accessToken, accessTokenSecret);
var directMessagesList = service.ListDirectMessagesReceived(new ListDirectMessagesReceivedOptions { Count = 200});