This project has moved and is read-only. For the latest updates, please go here.

Help Please

Mar 3, 2013 at 11:11 PM
I just started using twitter API, i want to post tweets from my own account (application owner) so that i dont have to get a PIN, how do i set this up? Currently its like this:

        Dim credentials As IOAuthCredentials = New InMemoryCredentials

        credentials.ConsumerKey = ConfigurationManager.AppSettings("twitterConsumerKey")
        credentials.ConsumerSecret = ConfigurationManager.AppSettings("twitterConsumerSecret")

        Dim auth As PinAuthorizer = New PinAuthorizer()
        auth.Credentials = credentials
        auth.GetPin = AddressOf VerifierCallback
        auth.GoToTwitterAuthorization = Function(pageLink) Process.Start(pageLink)

        Dim twitterCtx As TwitterContext = New TwitterContext(auth)

        twitterCtx.Log = Console.Out

how can i skip the pin verification process if i have the access token and access token secret
Mar 3, 2013 at 11:15 PM

You can use the SingleUserAuthorizer instead. Here's the documentation for it:

Mar 3, 2013 at 11:15 PM
Edited Mar 3, 2013 at 11:15 PM
Thanks.. I got it to work, i just defined access token of my own account, 1 question, how to post image file with the status?
Mar 3, 2013 at 11:17 PM
You can use twitterCtx.TweetWithMedia().

Mar 3, 2013 at 11:20 PM
I dont see tweetwithmedia in functions list, or in the whole module i cant find the media
Mar 3, 2013 at 11:47 PM
just to note i m using VB code from source code section, i am able to post tweets but i just dont see the TweetWithMedia function anywhere
Mar 3, 2013 at 11:53 PM
There's an example in the C# demos that might give you a better idea of how to use it.
Mar 4, 2013 at 12:34 AM
Ok i just put sometime into this and converted from C# to VB.NET if anyone ever needs, you might include in your source

Tested and working ;)
    Private Sub UpdateStatusWithMedia(ByVal twitterCtx As TwitterContext)
        Dim status As String = "Testing TweetWithMedia"
        Const PossiblySensitive = False
        Const ReplaceThisWithYourImageLocation = "F:\avatar.jpg"

        Dim mediaItems = New LinqToTwitter.Media()
        mediaItems.Data = Utilities.GetFileBytes(ReplaceThisWithYourImageLocation)
        mediaItems.FileName = "avatar.jpg"

        Dim mediaList = New List(Of Media)

        Dim tweet As LinqToTwitter.Status = twitterCtx.TweetWithMedia(status, PossiblySensitive, mediaList)

        Console.WriteLine("Media item sent - Tweet Text: " + tweet.Text)

    End Sub
Nov 23, 2013 at 1:38 PM

forced into for a project, I tried to use your vb sub, but despite "tested and working" I get an error at

Dim mediaList = New List(Of Media)


'LinqToTwitter.List' has no type parameters and so cannot have type arguments.

any idea what's causing this?
I can't find a example in the demo files for TweetWithMedia

Nov 23, 2013 at 5:55 PM

This is a namespace issue where your code is looking at the List in LinqToTwitter. Try adding an Import declaration for System.Collections.Generic.

Nov 23, 2013 at 6:08 PM
Hi Joe,

So obvious I didn't see it.
great support, works like a charm now. thx!