Facebook developer toolkit RRS feed

  • Question

  • User-1246604461 posted

    I've been trying to implement Facebook Connect, via this site: http://devtacular.com/articles/bkonrad/how-to-retrieve-user-data-from-facebook-connect-in-aspnet/

    However, I get 2 error messages when using that code. Some other people have asked similar questions on the above site, but did not get any answers...

    If ConnectAuthentication.isConnected() Then
                Dim api As New API()
    ERROR: Type 'API' is not defined.

                api.ApplicationKey = ConnectAuthentication.ApiKey
                api.SessionKey = ConnectAuthentication.SessionKey
                api.Secret = ConnectAuthentication.SecretKey
                api.uid = ConnectAuthentication.UserID

                'Display user data captured from the Facebook API.

                Dim usr As Facebook.Schema.user = api.users.getInfo()
    ERROR: 'user' is ambiguous in the namespace 'Facebook.Schema'.

                Dim fullName As String = (usr.first_name & " ") + usr.last_name

                lblName.Text = fullName
                'Facebook Connect not authenticated, proceed as usual.
            End If

    What can I do?

    Monday, March 22, 2010 11:21 AM

All replies

  • User2130758966 posted

    Without having had much of a look the first thing that jumps out at me is that you dont have the facebook developer kit installed and added into your website.

    Right click on the top node of the website in the solution explorer. Click "Add reference".

    You should have some kind of .dll included in the kit and it should be in your \bin\ folder.

    Refer to the developer kit getting started guide if this doesn't help you...

    Monday, March 22, 2010 1:17 PM
  • User2130758966 posted

    I just looked at the tutorial site. If its getting as far as failing on the API() line then I am guessing you have forgotten the

    using facebook;
    using facebook.web;

    lines which would have crashed the compile before getting to your unknown reference.

    Monday, March 22, 2010 1:34 PM
  • User-1246604461 posted

    I placed all the required dll's in my /bin folder.
    Also included the import statements:
    Imports facebook
    Imports facebook.web

    What else can it be?

    Monday, March 22, 2010 1:50 PM
  • User2130758966 posted

    Perhaps the latest version of the facebook kit has changed the class names?

    The sample code in the documentation for the FB dev kit v3.0 hosted on codeplex uses a different casing:

    It uses Api() instead of API();

    Monday, March 22, 2010 2:00 PM
  • User-1246604461 posted

    Well..Im using VB, so casing does not apply here.
    But where is the Api class defined?

    I tried importing facebook.Rest, but then I get:
    'API' is ambiguous in the namespace 'Facebook.Rest'.   

    Monday, March 22, 2010 2:12 PM
  • User1657234241 posted

    I believe that the best way is to download Samples from Facebook Developer Toolkit. Find there Connect project and see how it is made. At least it works and you can base your website on

    this code.

    Monday, March 22, 2010 4:34 PM
  • User-1246604461 posted

    I tried the FBToolkit.Samples.Connect.Web sample.

    But when I copy that code exactly into my project I still get the same error:

    On codeline:
    Private _facebookAPI As Api

    I get:
    'Api' is ambiguous in the namespace 'Facebook.Rest'

    What does this mean? Im clueless!

    Tuesday, March 23, 2010 8:13 AM
  • User2130758966 posted

    I get:
    'Api' is ambiguous in the namespace 'Facebook.Rest'

    What does this mean? Im clueless!

    This means that Api is defined twice - in two namespaces that you have imported.

    Therefore you need to type it out with the namespace before it like


    So thats the explanation but I dont think its the solution because you shouldn't be including the facebook.rest namespace according to the tutorials and when you do it causes the ambigious issue.

    Tuesday, March 23, 2010 8:30 AM
  • User-1246604461 posted


    The Facebook.rest is included in the tutorial (FBToolkit.Samples.Connect.Web), in default.aspx.cs I find:
    using System;
    using System.Collections.Generic;
    using System.Web.UI;
    using Facebook.Rest;
    using Facebook.Schema;
    using Facebook.Session;
    using Facebook.Utility;

    Also I tried:
    Private _facebookAPI As Facebook.Rest.Api

    But the same error occurs.

    When I type "Facebook.Rest." my intellisense also doesnt show an Api class..it doesnt show anything at all actually. It does show some options when I type "Facebook."

    Any other suggestions? :)

    Tuesday, March 23, 2010 9:40 AM
  • User1817292206 posted

    hope this helps, but i was running into that deadend too and removed all .dlls except:


    seemed to kick in after that.

    Imports Facebook
    Imports Facebook.Web
    Imports Facebook.Rest
    Imports Facebook.Schema
    Imports Facebook.Utility
    Imports Facebook.Session

    Tuesday, June 15, 2010 2:05 PM
  • User-1898585663 posted

    I have experience the same problems when i import all the facebook dll api ...

    "'Api' is ambiguous in the name space 'Facebook.Rest'"


    in fact, in the winform and the Silverlight there is the same class with the same signature, so this result as an error because it can't have multiple class with the same definition.

    i hope this help :p

    Friday, August 6, 2010 11:41 PM
  • User-319159958 posted

    Thank you brudy,

    you are right. The problem stems from downloading the sample and converting it to VB. Then also from reading the instructions it clearly says to import ALL the dll's.

    I was having the same problem as everybody at the API line....


    but after deleting the references to all the dll's ecept the facebook and facebook.web then I can reference the api as such:

    Dim api As New Facebook.Rest.Api() and interlisense even works


    Friday, October 8, 2010 3:32 PM