How get the user/creator of tweet ?

Jan 21, 2014 at 9:25 AM
hi

i di gethometimeline() then in want to get the user who tweet something :
string s;
 foreach (Tweet list in loggedUser.GetHomeTimeline())
{
      // i try this but its not here
      foreach (UserMentionEntity user in list.UserMentions)
      {
       
      }
      s += list.Text;
}
someone know how to do this ?
Coordinator
Jan 21, 2014 at 9:56 AM
Edited Jan 21, 2014 at 9:58 AM
Hi,

To reply to the title question, the user who created a tweet can be found in tweet.Creator and it is an object of type IUser.
Here is an example where I believe you will have all the information you need :
var tokenUser = new TokenUser(token);
var tweets = tokenUser.GetHomeTimeline();
foreach (var tweet in tweets)
{
    Console.WriteLine("User '{0}' posted this tweet : {1}!", tweet.Creator.ScreenName, tweet.Text);
    Console.WriteLine("This tweet has been mentioned by the following users : ");
    foreach (var mention in tweet.UserMentions)
    {
        Console.WriteLine(mention.ScreenName);
    }
}
Sincerely,
Linvi
Jan 21, 2014 at 10:16 AM
Hi

Its work fir GetUserTimeline() but no for GetHomeTimeline.
it returns nothing for Creator.Name or ScreneName
Coordinator
Jan 21, 2014 at 1:44 PM
I have just verified and everything seems to be alright.
Would you please share your code and let me know which part is not working and precisely what you expect from your code.

Linvi
Jan 21, 2014 at 1:52 PM
It's exactly what you wrote in the first message
foreach (var tweet in tweets)
{
    Console.WriteLine("User '{0}' posted this tweet : {1}!", tweet.Creator.ScreenName, tweet.Text);
}
tweet.Creator.ScreenName = return nothing
tweet.Text = works

it's impossible that a tweet dont have a creator so...
Coordinator
Jan 21, 2014 at 2:17 PM
I am willing to help but I do not understand your bug as it is working perfectly fine on my machine and I have never got anyone reporting this kind of issue.

Consequently, would you please send me your project (zip file) on my contact profile.
Please send it with your credentials (I will not use your credentials or application for any other purpose than debugging your problem).

Regards,
Linvi
Feb 25, 2015 at 4:07 PM
Hello,

I have the same problem, I can get the text of a tweet, but when I want user info it doesn't return anything

Is there a way to resolve this problem?

Thanks in advance,

Han Swinkels
Coordinator
Feb 26, 2015 at 8:54 AM
Same as replied to freaks88 could you please send me your project in a Zip File on my contact profile page.

Thanks,
Linvi
Feb 26, 2015 at 2:26 PM
Hello,

What was the solution for him, because I'd rather not share my credentials.

Thanks in advance,

Han Swinkels
Coordinator
Feb 26, 2015 at 3:06 PM
There was no solution for him as he did not reply to my request.
You can send me your code without credentials if you want. I can try reproducing it and let you know if I can.

Linvi
Feb 27, 2015 at 2:17 PM
I will send you the file in a few hours

Han Swinkels
Feb 28, 2015 at 4:58 PM
Edited Feb 28, 2015 at 5:06 PM
I am actually so stupid :P
      timelineParameter.TrimUser = true;
Needed to change that to false...
Why did it took me so long to figure this out ? :(
Marked as answer by linvi on 2/28/2015 at 10:16 AM
Coordinator
Feb 28, 2015 at 5:16 PM
^^ well, good for you if you found the solution.
By default TrimUser should be set to false, so you don't need to set it at all.

Cheers,
Linvi