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

retweeting using Satus.ID

Nov 22, 2012 at 12:54 AM
Edited Nov 22, 2012 at 12:55 AM
When I try to retweet a status I get an error at "tc.Retweet(id).
I get "Error while querying Twitter."

Stack trace:

   at LinqToTwitter.TwitterExecute.ExecuteTwitter[T](String url, IDictionary`2 postData, Func`2 getResult)
   at LinqToTwitter.StatusExtensions.Retweet(TwitterContext ctx, String id, Action`1 callback)
   at LinqToTwitter.StatusExtensions.Retweet(TwitterContext ctx, String id)
   at browse.Controllers.AppHomeController.ReTweet(String id) in c:\Users\ABEL\Documents\Visual Studio 2012\Projects\TwitterApp3\TwitterApp2\TwitterApp2\Controllers\AppHomeController.cs:line 392
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.b__41()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.b__7(IAsyncResult _)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.b__33()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()

Inner exception:
{"The remote server returned an error: (403) Forbidden."}

 public virtual ActionResult ReTweet(string id) { bool success = false; string user = WebSecurity.CurrentUserName; TwitterContext tc = getTwitterCtx(user); var result = tc.Retweet(id);

Any ideas?

Nov 22, 2012 at 3:56 AM


I think you might have tried to retweet a tweet twice. Maybe try with a tweet that you haven't retweeted yet. Also, use Fiddler to find out what Twitter returns. Here's what Twitter sent back to me after retweeting twice:

{"errors":"sharing is not permissible for this status (Share validations failed)"}


Nov 30, 2012 at 3:04 AM

Thanks that helped alot!


I have another question.


When I get a users timeline(list of status'), user entity associated with the status does not have a screenname value.

I am trying to have the ability to reply to a status on the users timeline so I need the screenname of the user who tweeted.


this is the associated status object that is returned:


    Annotation: {LinqToTwitter.Annotation}
    Contributors: Count = 0
    Coordinates: {LinqToTwitter.Coordinate}
    Count: 0
    CreatedAt: {11/29/2012 2:48:54 AM}
    Entities: {LinqToTwitter.Entities}
    ExcludeReplies: false
    Favorited: false
    Geo: null
    ID: null
    IncludeContributorDetails: false
    IncludeEntities: false
    IncludeRetweets: false
    InReplyToScreenName: null
    InReplyToStatusID: null
    InReplyToUserID: null
    MaxID: 0
    Page: 0
    Place: {LinqToTwitter.Place}
    PossiblySensitive: false
    Retweet: null
    RetweetCount: 0
    Retweeted: false
    RetweetedStatus: {LinqToTwitter.Status}
    ScreenName: null
    SinceID: 0
    Source: "Abel Tara"
    StatusID: "273981834688344064"
    Text: "hi there"
    TrimUser: false
    Truncated: false
    Type: Home
    User: {LinqToTwitter.User}
    UserID: null
    Users: null

And this is the associated User object:

Categories: null
    ContributorsEnabled: false
    CreatedAt: {2/17/2010 4:27:28 AM}
    Cursor: null
    CursorMovement: {LinqToTwitter.Cursors}
    DefaultProfile: true
    DefaultProfileImage: false
    Description: ""
    FavoritesCount: 9
    FollowersCount: 315
    Following: true
    FollowRequestSent: false
    FriendsCount: 299
    GeoEnabled: true
    ID: null
    Identifier: {LinqToTwitter.UserIdentifier}
    ImageSize: Normal
    IncludeEntities: false
    IsTranslator: false
    Lang: null
    LangResponse: "en"
    ListedCount: 2
    Location: ""
    Name: "Blas T"
    Notifications: false
    Page: 0
    PerPage: 0
    ProfileBackgroundColor: "C0DEED"
    ProfileBackgroundImageUrl: ""
    ProfileBackgroundImageUrlHttps: ""
    ProfileBackgroundTile: false
    ProfileImage: null
    ProfileImageUrl: ""
    ProfileImageUrlHttps: ""
    ProfileLinkColor: "0084B4"
    ProfileSidebarBorderColor: "C0DEED"
    ProfileSidebarFillColor: "DDEEF6"
    ProfileTextColor: "333333"
    ProfileUseBackgroundImage: true
    Protected: true
    Query: null
    ScreenName: null
    ShowAllInlineMedia: false
    SkipStatus: false
    Slug: null
    Status: {LinqToTwitter.Status}
    StatusesCount: 2141
    TimeZone: "Mountain Time (US & Canada)"
    Type: Show
    Url: null
    UserID: null
    UtcOffset: -25200
    Verified: false
Thanks for your help!

Nov 30, 2012 at 4:33 AM

You can use the Identifier property to get ScreenName and UserID. Here's my FAQ: