How to create a simple Facebook desktop application with C#

Hey there, while surfing the web I found that there are not too much tutorials about how to create a desktop application for facebook.

Here I will show you a really basic tutorial to create a facebook application for your desktop that will update your status.

I’m assuming that you already know the basics about facebook Web Services, if you don’t, go to


Visual Studio 2008 Express

Facebook Developer Toolkit

1. Add Facebook Components to Visual Studio

Once you have installed the Visual Studio 2008, add the facebook components to the Visual Studio Toolbox.

Right click on the toolbox area and select “Choose Items…”


Now click on the “Browse…”  Button, locate the folder where the facebook components are and add the following libraries:



facebook.web.dll <— Add this if you want to create Web Projects


Then simply click the “OK” button and you are done.

You can add these components to a new tab named “Facebook” or something if you don’t want to have them on the “General” tab.

2. Create a new project for the application.

Go to File > New Project > Windows Forms Application.


Drag the “FacebookService” component to your application Form and add the API Key and the Secret Key that facebook has already assign to your application.


Now add a Button to Log In, a TextBox to Write your status and another Button to Share your status.


Double Click on the “Login” Button to write the code that it will execute. Add the following lines:


facebookService1.GetExtendedPermission(facebook.Types.Enums.  Extended_Permissions.status_update);
catch (Exception exception)
MessageBox.Show(this, exception.Message, “Error”);

The previous lines will connect you to facebook and ask for the necessary permissions that the application needs to run.

Now lets tell the “Share” Button to do something. Double click on it and add the following lines to the code:

String status = updateText.Text;
Boolean updated = facebookService1.API.users.setStatus(status);
if (updated)
updateText.Text = “”;

These previous lines will update your status on facebook and will clear the textbox.

Now you can run your application and update your status from the desktop.

I hope that this tutorial help. Feel free to write questions or comments if you have them.

WebLab | Salvador Fuentes


No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: