Howto for creating a webpage plugin which retrieves information from a Facebook Page with the 3.0 API?

Dec 15, 2009 at 1:51 PM
Edited Dec 15, 2009 at 3:47 PM

I want to develop an application which can read feeds from a specific page wall in facebook.
The main idea, is to use FQL to get the latest posts on the wall and publish them on a website, in a completely seperate way compared to f.ex. Facebook box app.

However, I'm having an issue trying to connect to Facebook with the 3.0 API.
I've made a reply in the http://facebooktoolkit.codeplex.com/Thread/View.aspx?ThreadId=76599 thread, however I'm not sure if the problem is the same or not.

I can start with what I've done so far:

I have created an app in the facebook developer with the following settings:
 

Under Settings --> Authentication:
Innstallable to: Users Facebook Pages (want to tinker with both)
The rest of the fields are empty.

Under settings --> Profiles
Empty

Under setttings --> Canvas
filled out Post-Authorise Redirect url to the server without a specified port

Canvas settings in chronological order: Iframe, Smart size, full width and off

Under settings --> Connect
Connect URL: set my direct url to the server
Filled out the base domain for the server
Friend linking access set to 'Not requested'

Under settings --> widgets
Done nothing here

Under settings --> Advanced
App type: web
Sandbox mode: enable

All other options are set by default.

As far as I can understand, the way you create a facebook connection :

 

ConnectSession cSession = new ConnectSession(appkey, secretKey);

if(cSession.IsConnected()) { doSomething; }

I end up with an error when the ConnectSession returns the object: "Cannot fetch the value of field 'LoginCompleted' because information about the containing class is unavailable."
According to the http://facebook.claritycon.com/help/Index.aspx API, this is the way to create a connection.

My questions are then:

1. Are there any settings I've missed when I want to develop at localhost? I've pretty much read everything about how to connect with .Net
Obviously there are a few settings I'm missing, either at the facebook application, the vs project, the IIS (XP Pro) or the network I'm using.
In the settings I mentioned I'm using a server, however, I just tried the code there to see if the localhost was to blame, though I got the same result ..

2. Is the 3.0 API faulty?

3. FYI I can't see the 

EventUser 

class is available in the facebook reference. Is there a particular reason why it would deviate so much from the 2.0 doc?
I reckon the api documentation for the the 3.0 version of the API, isn't complete?
 

 

using System;
using System.Collections.Generic;
using Facebook.Rest;
using Facebook.Session;

namespace FacebookConnection.Connector
{
public partial class FacebookConnector : System.Web.UI.UserControl
{
private const string ApplicationKey = "123";
private const string SecretKey = "445";
private const long PageId = 1234;


private Api _facebookAPI;

private ConnectSession _connectSession;

//private List<EventUser> _eventUsers;
protected void Page_Load(object sender, EventArgs e)
{
_connectSession = new ConnectSession(ApplicationKey, SecretKey);
litStatus.Text = "";

if(!_connectSession.IsConnected())
{
litStatus.Text = "Login failed!";
}
else
{
litStatus.Text = "Login succeded";
_facebookAPI = new Api(_connectSession);
var fields = _facebookAPI.Pages.GetFields();
var pageIds = new List<long> {PageId};
var page = _facebookAPI.Pages.GetInfo(fields, pageIds, null);

if(!Page.IsPostBack)
{

}
}
}
}
}