How I can add a friend to my friends list?

Apr 10, 2014 at 1:56 AM
Hi.

I wont to add a friend:
        TwitterCredentials.SetCredentials("AccesToken", "AccesTokenSecret", "ConsumerKey", "ConsumerKeySecret");
        var usuario = User.GetUserFromScreenName(TxtUsuario.Text);
        var YoUsuario = User.GetLoggedUser();
        YoUsuario.Friends.add(usuario);
In the last line I've a exception because YoUsuario.Friends is a Null object

What's the correct method? Any can help me?

Thanks.
Coordinator
Apr 10, 2014 at 12:36 PM
Hi,

What you want to use is :
YoUsuario.FollowUser(usuario);
Friends and Follower are always null. They are properties that developers can set on their own if they are willing to store the list of friends/followers retrieved from YoUsuario.GetFriends();.

I understand your confusion, I would like to add a method 'AddFriend' that would do the same as 'FollowUser' but I am not sure what is more easy to guess for developers.

Please let me know your point of view.

Regards,
Linvi
Marked as answer by linvi on 4/10/2014 at 5:36 AM
Apr 11, 2014 at 1:47 AM
Edited Apr 11, 2014 at 1:56 AM
I've tried to use ".FollowUser" method, but return always "false", that is, the user is not following. That's why I've tried ".Friends.add", but does not work.

Excuse me if my English is not very good. I'm Spanish, my english nivel is very basic and I use a translator program. :-)

Regards.