私の英語は申し訳ありませんが、お手伝いをします!
まず、認証を作成する必要があります。ユーザーとパスワードは、自分のtwitterカウントのものです。あなたが名前を入れaplicattionを登録し、ここで、このページhttp://dev.twitter.comうtwitterでaplicationを登録する必要があり、別の方法が、あり
UsernamePasswordAuthorization cxauthentication = new UsernamePasswordAuthorization();
ctxauthenticatin.UserName = userName; // Put in your Twitter Account
ctxauthenticatin.Password = password; // and password
ctxauthenticatin.AllowUIPrompt = false;
ctxauthenticatin.SignOn();
var ctxTwitterContext = new TwitterContext(ctxauthentication);
ctxTwitterContext.UpdateStatus("test text");
、ウェブのdireccionは、その後、彼らはあなたのConsumerKey、ConsumerSecertを与え、あなたがAccess Tokenを生成するのを止めれば、彼らはあなたにAccessTokenとAccessTokenSecretを与えます。 Remenber設定に移動し、ダイレクトメッセージの読み取り、書き込み、およびアクセスオプションを選択します。 AccessTokenを生成します。あなたのコードでこれで[OK]を、あなたはこのような何かを:
public partial class _Default : System.Web.UI.Page
{
private WebAuthorizer auth;
private TwitterContext twitterCtx;
protected void Page_Load(object sender, EventArgs e)
{
IOAuthCredentials credentials = new SessionStateCredentials();
if (credentials.ConsumerKey == null || credentials.ConsumerSecret == null)
{
credentials.ConsumerKey = "Here put your ConsumerKey";
credentials.ConsumerSecret = "Here put your ConsumerSecret"
}
auth = new WebAuthorizer
{
Credentials = credentials,
PerformRedirect = authUrl => Response.Redirect(authUrl)
};
if (!Page.IsPostBack)
{
auth.CompleteAuthorization(Request.Url);
}
twitterCtx = new TwitterContext(auth);
}
protected void authorizeTwitterButton_Click(object sender, EventArgs e)
{
auth.BeginAuthorization(Request.Url);
}
保護無効SendTweet_Click(オブジェクト送信者、EventArgsの電子) { twitterCtx.UpdateStatus( "私のテストツイート");
}
Easy !!それはどのように動作しますか?最初にauthorizeTwitterButtonというボタンをクリックすると、Twitterアカウントの権限が開始され、新しいウィンドウが開き、アプリケーションを承認したtwitterのログインが表示され、twitterは認証ボタンをクリックしてページにリダイレクトしますあなたは新しいつぶやきを投稿します!
また、開始方法と完了方法を使用する必要がない別の方法もあります。ここでは、すべての資格情報を直接紹介します。例えば、
var auth = new SingleUserAuthorizer
{
Credentials = new InMemoryCredentials
{
ConsumerKey = "your ConsumerKey",
ConsumerSecret = "Your consumerSecret",
OAuthToken = "your AccessToken",
AccessToken = "your AccessTokenSecret"]
}
};
var ctxTwitterContext = new TwitterContext(auth);
ctxTwitterContext.UpdateStatus("test text");
Ok!私のアンカーがあなたを助けることを願っています!詳細については、http://linqtotwitter.codeplex.com/ の文書をご覧ください。私のアンサーが好きなら、ただクリックをしてください! jaja
多くの苦痛と様々な.NET twitterラッパーの後、私はnugetパッケージマネージャーhttp://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970cを取得し、そこからtweetsharpをインストールしました。 –
Linq-to-twitter?コードには140文字しか使用できません。代わりに、TwitterContext(UsernamePasswordAuthorization)コンストラクタを試してみてください。 –
@ HansPassant:私はそれに関する文書は見ません。しかし、私はtweetsharpとmono/linuxを使ってこれを手に入れました。 –