TweetSharp SendTweetWithMediaOptions example

Has anyone here tried tweeting with an image using TweetSharp?

I tried the following:

Dictionary<string, Stream> imageDict = new Dictionary<string, Stream>(); imageDict.Add(imagePath, imageStream); // I'm getting an error with the line below. // It saying I have some invalid arguments. :( status = service.SendTweet(new SendTweetWithMediaOptions() { Status = readerMsg.Message, Images = imageDict }); 

But the last line gives me the wrong argument error without explanation.

I tried to take a look at their GitHub , but the sample only illustrates how to post a simple text message.

+4
source share
2 answers

See the first part of this pull request: TweetSharp Github

a call to SendTweetWithMedia instead of SendTweet may take place.

In addition, the key in the dictionary does not seem to be the path of the image (you still give it a Stream), the example passes "test" to it.

- ntn have fun

+5
source

service.SendTweet() accepts a parameter of type SendTweetOptions . If you want to post images you can use

 service.SendTweetWithMedia(new SendTweetWithMediaOptions { Status = "message", Images = dictionary } ); 
+1
source

All Articles