Error in search retweets

Jun 15, 2010 at 1:31 PM
Edited Jun 15, 2010 at 1:32 PM
I saw a method that has given the id of a tweett he returns the amount of retwet, but when I try to run the method does not work. I wonder if someone could help me find the error. If so I can send the project to the email.
Jun 15, 2010 at 1:32 PM
Edited Jun 15, 2010 at 1:34 PM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LinqToTwitter;

namespace TestLINQtoTwitter
{
class Program
{
static void Main(string[] args)
{
getCountRetweets(16151285130);
}
public static int getCountRetweets(long idTweet)
{
var twitterCtx = new TwitterContext();
var result = from tweet in twitterCtx.Status
where
tweet.ID == idTweet.ToString() &&
tweet.Type == StatusType.Retweets
select tweet;
return result.Count<LinqToTwitter.Status>();
}
}
}
Coordinator
Jun 15, 2010 at 2:04 PM

Hi Pedro,

I ran the following, which produced a count of 20 retweets:

        private static void RetweetsCount(TwitterContext twitterCtx)
        {
            long idTweet = 16151285130;

            var result = 
                from tweet in twitterCtx.Status
                where tweet.ID == idTweet.ToString() &&
                      tweet.Type == StatusType.Retweets
                select tweet;

            Console.WriteLine("Retweet Count: " + result.Count<LinqToTwitter.Status>()); 
        }

I didn't see any error.  It's checked into the source code, ChangeSet #68830, if you want to check it out.  Try wrapping your code in a try/catch and printing ex.ToString(), where ex is the Exception and posting that.
Joe
Jun 15, 2010 at 2:45 PM
Appeared the following message: Exception has been throw by the target of an invacation.
You have mail in order to send you the code?
Jun 15, 2010 at 2:47 PM
Appeared the following message: Exception has been throw by the target of an invacation.
You have mail in order to send you the code?
Jun 15, 2010 at 3:14 PM
Hello JoeMayo,

I posted the project on megaupload, so you can then look at the project. He is small, only has a little more than 1 mega. Then you can also post and pass me the link.

http://www.megaupload.com/?d=3W8H34JU
Coordinator
Jun 15, 2010 at 8:50 PM

I can't get to this right away, but let me try to point you in the right direction.  Anytime you see the "Exception has been thrown by the target of an invocation", you'll know that this exception is wrapping another. There is an exception chain that you can follow by lookin at the InnerException.  Keep following the InnerException properties until you find an exception with information that makes sense.  Look at all the properties of the exception to find out what is happening.  If you find a TwitterQueryException, be sure to look at the Response property to see the message.  Also, look at the HttpError property in case it has something of interest.

Joe

Jun 16, 2010 at 12:01 PM
You must log in to search? Appeared the following message: The remote server returned an error: (401) Unauthorized. And there was a protocol error
Jun 16, 2010 at 5:12 PM

Hey guys. let's help here

Coordinator
Jun 16, 2010 at 10:37 PM
Strange because the API says that authentication isn't required for a retweet query. Check out the Program.cs file in the LinqToTwitterDemo project and use the OAuth example code to authenticate. Joe
Jun 17, 2010 at 12:59 PM
So the API must be wrong or outdated, because I only managed to solve the problem because of the code presented in the following post:
http://linqtotwitter.codeplex.com/Thread/View.aspx?ThreadId=210941