This project has moved and is read-only. For the latest updates, please go here.


Tweet with media


I'm having an issue with the last version of this api (2.1.8)
I'm trying to send a tweet with media but i keep getting an error.
I have tried with the demo posted on this site but it doesn't work
string status = "Testing TweetWithMedia #Linq2Twitter £ " + DateTime.Now.ToString(CultureInfo.InvariantCulture);
            const bool PossiblySensitive = false;
            const decimal Latitude = StatusExtensions.NoCoordinate; //37.78215m;
            const decimal Longitude = StatusExtensions.NoCoordinate; // -122.40060m;
            const bool DisplayCoordinates = false;
            var mediaItems =
                new List<Media>
                    new Media
                        Data = Utilities.GetFileBytes("C:\\temp\\temp.png"),
                        FileName = "200xColor_2.png",
                        ContentType = MediaContentType.Png

            Status tweeet = twitterCtx.TweetWithMedia(
                status, PossiblySensitive, Latitude, Longitude,
                null, DisplayCoordinates, mediaItems, null);
The error I get is the following:

"Status creation failed: Tweet creation failed"

More info about the error:

-Error code : 190
-HttpError: ProtocolError
-InnerException: The remote server returned an error: (403) Forbidden

I'm using a SingleUserAuthorizer, and have no problems with the UpdateStatus method, but TweetWithMedia gives this error in both forms
TweetWithMedia(this TwitterContext twitterCtx, string status, bool possiblySensitive, List<Media> mediaItems);
TweetWithMedia(this TwitterContext twitterCtx, string status, bool possiblySensitive, decimal latitude, decimal longitude, string placeID, bool displayCoordinates, List<Media> mediaItems, Action<TwitterAsyncResponse<Status>> callback);
Closed Aug 22, 2013 at 1:51 AM by JoeMayo


JoeMayo wrote Aug 21, 2013 at 6:03 PM

I'm unable to reproduce, but I did do an update that changes the content type from image/<img type> to application/octet-stream. This is checked in and available if you would like to download the source code and test.


Gryfyn wrote Aug 21, 2013 at 11:25 PM

Hi, thank you for your response.
I think that it was an error in the image. I created a PNG with paint and now it works, so maybe that was the true problem, that the image was corrupted, or had missing properties.
I could see it in the image viewer, but couldn't publish it.