wallace740
wallace740

Reputation: 1380

How can I get the Twitter follower screenNames of a given Username with Twitterizer?

OAuthTokens tokens = new OAuthTokens();
tokens.AccessToken = "188817262xxxxx";
tokens.AccessTokenSecret = "GNqhB1gkxxxx";
tokens.ConsumerKey = "Q6xxxxx";
tokens.ConsumerSecret = "2eZyxxxxxx";

var<TwitterUser> showUserResponse = TwitterUser.Show(tokens, "twitterUsername");
if (showUserResponse.Result == RequestResult.Success)
    {
    string screenName = showUserResponse.ResponseObject.ScreenName;
    Response.Write(screenName);
    Response.Write("<br>");
    Response.Write(showUserResponse.ResponseObject.NumberOfFollowers);
    }

With this code I can get my Twitter screenName and numberOfFollowers, but I want to print those follower screenNames on my asp.net application. How can I achieve that?

FollowersOptions options = new FollowersOptions();
options.ScreenName = "wallace740";
TwitterResponse<TwitterUserCollection> followers = TwitterFriendship.Followers(options);

// Response.Write(followers.Content);

How can I get the screenNames of my followers from this JSON (followers.Content gives me a JSON result)?

Upvotes: 1

Views: 1380

Answers (1)

user1797792
user1797792

Reputation: 1189

You can enumerate through the ReponseObject.

        foreach (var follower in followers.ResponseObject)
        {
            follower.ScreenName;
        }

Upvotes: 1

Related Questions