Some beginner help...

Aug 5, 2009 at 4:00 PM

OK I am using the FDT v. 2.1. I am following the beginning desktop application sample as outlined in the documentation. Everything is running smoothly until I run the application. I get an exception that says "parameter uid or session key required" . What do I need to do to get this code to work properly?


Thanks for any and all help!



Aug 5, 2009 at 4:45 PM

Trust me, a minute of googling will solve this problem of yours. The idea here is that not every method of facebok api can be called by anyone and retrieve information about everything. Since I can't view ur profile pictures, one needs to log in to facebook for that purpose, and that's where you need an active session.

Aug 5, 2009 at 4:57 PM

I googled the error message, and all I got were results that were related to Facebook. That's good. The one article I found on the Facebook Developer Wiki ( says I need a session key... I have no idea where to get one or even where to place it in the application.

Aug 5, 2009 at 5:13 PM

may be u can paste a few lines of code where the exception is raised?

Aug 5, 2009 at 5:16 PM

It's just the one line,


FriendList1.Friends = FacebookService1.friends.getUserObjects()


That's what's highlighted when the exception is raised.

Aug 5, 2009 at 5:40 PM

Well, offcourse the exception will be called at some particular one line, but what is importnat here is what attributes values with the facebokService object is initialized of, so please share initializiation lines before this particular one.

Aug 5, 2009 at 5:46 PM

That's it! That's the only code besides the Form Load handler. THAT's IT!

Aug 5, 2009 at 5:47 PM

You see, the point here is whether you have set a valid session key for facebookService1 object before calling this line. Perhaps NO.

This method returns the list of all of your logged in friends. Now this method has basically three overloads, let's talk about the first one. The first overload doesn't take any input argument and thus it is assumed that the friends list will be returned against current logged in user. How does facebookService1 will identify current logged in user? On the basis of ession, so if you are to use the first overload, with no input arguments, you need to set session key first, soemthing like

facebookService1.sessionKey = "Key Here"; //You will get this key by studying about session

The other overload takes one input argument, and that is userId against whom you wnat to obtain the list of friends. Say you want to get the list of friends for a user 233423232, then you will call this method as following,

List<facebook.schema.user> soemething = facebookService1.friends.getUserObjects(233423232);

and only public schema information will be returned for this user.

I would suggest you to study about session and security thing. That is, why few methhods are public and few are private (require active session)



Aug 5, 2009 at 6:03 PM

OK... where would  I find some information about this?

Aug 5, 2009 at 6:18 PM

Bro google it. For your current proble, the code given on this Url will help, though this is about ASP and you are working on a desktop application. Also you need to use Facebook Connect in my understanding for authentication thing,

Aug 9, 2009 at 7:24 PM

Hello drummerboy0511. I had the same problem. The example in the User's Guide is not complete. Try this:


Public Class Form1

    Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            FacebookService1.IsDesktopApplication = True
            If IsNothing(FacebookService1.SessionKey) Then
            End If

            FriendList1.Friends = FacebookService1.friends.getUserObjects()
        Catch exc As Exception
            MsgBox(exc.ToString & " " & exc.Message)
        End Try

    End Sub

End Class