Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Example of Follow/Unfollow

$
0
0
I try this solution with the next code:

TwitterCredentials.SetCredentials("UserAccesToken", "UserAccesSecret", "ConsumerKey", "ConsumerSecret");
        var usuario = User.GetUserFromScreenName(TxtUsuario.Text);
        var Seguidores = usuario.GetFollowers();
        var YoUsuario = User.GetLoggedUser();

        foreach (var Seguidor in Seguidores)
        {
            var userToFollow = User.GetUserFromScreenName(Seguidor.ScreenName);
            YoUsuario.FollowUser(userToFollow);
        }
    }
}
but I've the next exception in the line ... YoUsuario.FollowUser(userToFollow):

No se controló System.ArgumentNullException
HResult=-2147467261
Message=El valor no puede ser nulo.
Nombre del parámetro: s
Source=mscorlib
ParamName=s
StackTrace:
   en System.IO.StringReader..ctor(String s)
   en Newtonsoft.Json.Linq.JObject.Parse(String json)
   en TweetinviLogic.Wrapper.JObjectStaticWrapper.GetJobjectFromJson(String json)
   en TweetinviCredentials.TwitterAccessor.ExecutePOSTQuery(String query)
   en TweetinviCredentials.TwitterAccessor.TryExecutePOSTQuery(String query, JsonConverter[] converters)
   en TweetinviControllers.Friendship.FriendshipQueryExecutor.CreateFriendshipWith(IUserIdDTO userDTO)
   en TweetinviControllers.Friendship.FriendshipController.CreateFriendshipWith(IUserIdDTO userDTO)
   en TweetinviControllers.Friendship.FriendshipController.CreateFriendshipWith(IUser user)
   en TweetinviLogic.LoggedUser.<>c__DisplayClassf.<FollowUser>b__e()
   en TweetinviLogic.LoggedUser.StartLoggedUserOperation[T](Func`1 operation)
   en TweetinviLogic.LoggedUser.FollowUser(IUser user)
   en ConsigueSeguidores.Form1.BtnAceptar_Click(Object sender, EventArgs e) en e:\Mis documentos\Visual Studio Projects\ConsigueSeguidores\ConsigueSeguidores\Form1.cs:línea 31
   en System.Windows.Forms.Control.OnClick(EventArgs e)
   en System.Windows.Forms.Button.OnClick(EventArgs e)
   en System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   en System.Windows.Forms.Control.WndProc(Message& m)
   en System.Windows.Forms.ButtonBase.WndProc(Message& m)
   en System.Windows.Forms.Button.WndProc(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   en System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   en System.Windows.Forms.Application.Run(Form mainForm)
   en ConsigueSeguidores.Program.Main() en e:\Mis documentos\Visual Studio Projects\ConsigueSeguidores\ConsigueSeguidores\Program.cs:línea 20
   en System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   en System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   en System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   en System.Threading.ThreadHelper.ThreadStart()
InnerException:

I'm a newbie and do not understand why it gives that error. Can anyone help me?

Thanks.

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>