如何使用Tweetsharp发布图像,文本和链接 [英] How Do I Post Image,Text And Link Using Tweetsharp
问题描述
 
我发布的图片是使用tweetshare api在Twitter上发送文本并获得正确的响应,但无法使用超链接制作这些信息,以便用户可以在mywebsite上看到
完整信息
这是我的代码。
Bitmap img = new Bitmap(Server。在MapPath(QUOT;〜/ IMG / test.jpg放在"));
MemoryStream ms = new MemoryStream();
img.Save(ms,System.Drawing.Imaging.ImageFormat.Jpeg);
ms.Seek(0,SeekOrigin.Begin);
Dictionary< string,Stream> images = new Dictionary< string,Stream> {{" mypicture",ms}};
var result = service.SendTweetWithMedia(new SendTweetWithMediaOptions {Status ="这是我的第二条推文",Images = images});
可以任意请帮助我..
Syed Faique Ali
< blockquote>
你在这里尝试过这个样本:
https://github.com/danielcrenna/tweetsharp
使用 TweetSharp ;
使用 Hammock ;
TwitterService service = new TwitterService(consum) erKey,consumerSecret);
$
service.AuthenticateWith( " accessToken " ,
" accessTokenSecret " );
$
//准备OAuth对TwitPic的回应请求
$
RestRequest request = service.PrepareEchoRequest();
request.Path = " uploadAndPost.xml " ;
请求.AddFile( " media " , " failwhale " ,
" failwhale.jpg " , " image / jpeg " );
$
request.AddField( " key " , " apiKey " );
//< - 使用TwitPic注册以获取API密钥
request.AddField( " 消息" ,
" Failwhale!" );
//使用吊床将照片发布到TwitPic
RestClient客户端= 新 RestClient {授权= " http://api.twitpic.com/ " ,VersionPath =
" 2 " };
$
RestResponse response = client.Request(request);
您也可以下载代码。
chanmm
>
I am posting image with text on twitter using tweetshare api and getting ok response, but unable to make these info with hyperlink so that user can see
full info at mywebsite
here is my code.
Bitmap img = new Bitmap(Server.MapPath("~/img/test.jpg")); MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); ms.Seek(0, SeekOrigin.Begin); Dictionary<string, Stream> images = new Dictionary<string, Stream> { { "mypicture", ms } }; var result = service.SendTweetWithMedia(new SendTweetWithMediaOptions { Status = "this is my second tweet", Images = images });
can any one help me please..
Syed Faique Ali
Have you try the sample here:
https://github.com/danielcrenna/tweetsharp
using TweetSharp;
using Hammock;
TwitterService service = new TwitterService(consumerKey, consumerSecret);
service.AuthenticateWith("accessToken", "accessTokenSecret");
// Prepare an OAuth Echo request to TwitPic
RestRequest request = service.PrepareEchoRequest();
request.Path = "uploadAndPost.xml";
request.AddFile("media", "failwhale", "failwhale.jpg", "image/jpeg");
request.AddField("key", "apiKey"); // <-- Sign up with TwitPic to get an API key
request.AddField("message", "Failwhale!");
// Post photo to TwitPic with Hammock
RestClient client = new RestClient { Authority = "http://api.twitpic.com/", VersionPath = "2"};
RestResponse response = client.Request(request);You can download the code too.
chanmm
这篇关于如何使用Tweetsharp发布图像,文本和链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!