Reputation: 1
Following is my c# code. It is crashing Visualstudio on executing followuser method. My idea is one user has to follow another user. For Instance, A user with Email, password has to follow a user with screenname. Hope you help me on this.
I have got my user(ME) values, with this I am following a user with screename(someone).
TwitterService ts = new TwitterService(ConfigurationManager.AppSettings["TwitterAuthenticationConsumerKey"], ConfigurationManager.AppSettings["TwitterAuthenticationConsumerSecretKey"]); ts.AuthenticateWith(ConfigurationManager.AppSettings["TwitterAuthenticationToken"], ConfigurationManager.AppSettings["TwitterAuthenticationTokenSecretKey"]);
//need to provide username and password
options.Q = "laxmanan90";
options.IncludeEntities = true;
var users = ts.SearchForUser(options);//Get list of users by query
followoptions.ScreenName = "someone";
followoptions.Follow = true;
followoptions.UserId = 363817617;
foreach (var user in users)
{
try
{
var u = ts.FollowUser(followoptions);//Follow user
}
catch { }
}
Upvotes: 0
Views: 487
Reputation: 11
This worked for me... Hopefully it fixes your problem.
public void followUser(string targetName)
{
twitter.FollowUser(new FollowUserOptions() { ScreenName = targetName });
}
Upvotes: 1