2016-08-15 67 views
0

我想在Twitter時間軸上使用Asp.Net網頁發佈。 我已經在twitter開發者帳戶中註冊了我的頁面,並獲得了所有密鑰和令牌。 我曾嘗試與代碼 Code ProjectDotNet Tutorial, DOTNET的豐達
www.dotnetfunda.com/articles/show/3196/post-message-with-image-on-twitter-using-csharp需要在Twitter中使用ASP.Net發佈文本

網站頁面運行良好,但沒有任何內容發佈到Twitter帳戶。 請給我一些工作鏈接,我會得到一些提示或找到代碼。

回答

0

與Tweetsharp相反,Tweetinvi正在積極開發中。 有了這個庫,你可以實際發佈的tweet

// Setup the credentials of the account to use 
Auth.SetUserCredentials("CONSUMER_KEY", "CONSUMER_SECRET", "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET"); 

// Upload the image/video that you want to attach to your Tweet (up to 4 images) 
byte[] binary = File.ReadAllBytes(filePath); 
var media = Upload.UploadImage(binary); 

// Publish your tweet 
var tweet = Tweet.PublishTweet("This is my awesome photo!", new PublishTweetOptionalParameters 
{ 
    Medias = new List<IMedia> { media } 
}); 

// The variable tweet now contains all the information provided by Twitter. 

您可以找到有關如何發佈的文檔中鳴叫的更多信息:https://github.com/linvi/tweetinvi/wiki/Tweets

Tweetinvi github項目提供了一個示例項目(Examplinvi.Web),該項目完全符合您的需求。

你可以在這裏找到:

請讓我知道如果這個回答你的問題。另請注意,我是圖書館的主要開發人員。

+0

我試過這個,但Tweet.PublishTweet不工作。沒有錯誤,異常來了只有點擊按鈕不會返回任何內容。我有一些其他的出路。使用這個鏈接「」http://www.twitter.com/intent/tweet?text=「+ TextBox1.Text」我已經符合我的要求 –

相關問題