FriendList + User Status C# does not work

Oct 19, 2010 at 9:15 AM
Edited Oct 19, 2010 at 9:18 AM

Hi there,

im trying to build a application in C# that shows me my facebook friend list with the Facebook Development Kit.
This works propably and is not my Problem i have.
I would like a popup that shows me the last Status Message of my friend if i click on the Name of my friend.
This does not work i tryed the whole day put the status.get methode won't work.

Can anybody help me?

I have a FriendList and a DataGrid to show my friends.
Additionally i have 2 Textboxes one that should display my current status
and the secent to update my status.

This does not work, too.
I can't even read my own Status Message what am i doing wrong?

Here is my Source code:



using System;
using System.Windows.Forms;
using DesktopApp.Properties;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Facebook.Schema;
using Facebook.Web;
using Facebook.Winforms;

namespace DesktopApp
    public partial class DesktopApp : Form
        private bool _isLoading;
        public DesktopApp()
            //Disable selection notifications
            _isLoading = true;

            //Connect to Facebook using Facebook Deleoper Toolkit
            facebookService1.ApplicationKey = Settings.Default.APIKey;
            //facebookService1.Secret = Settings.Default.APISecret;        <-- Secret was not found

        private void DesktopApp_Load(object sender, EventArgs e)
            #region FDT Control Example

            //Set up Facebook Development Toolkit controls

            //Bind friends list control to current users's friends
            friendList1.Friends = facebookService1.Friends.GetUserObjects();

            #endregion FDT Control Example

            #region Winform control Example

            //Set up standard .Net Winform controls

            //Bind DataGridView to current users's friends
            dataGridView1.DataSource = facebookService1.Friends.GetUserObjects();

            #endregion Winform control Example

            //Enable selection notification
            _isLoading = false;

        private void SetupFDTControls()
            //Wire up event handlers
            friendList1.FriendSelected += friendList1_FriendSelected;

        private void SetupWinformControls()
           //Wire up event handlers
            dataGridView1.SelectionChanged += dataGridView1_SelectionChanged;

            //Turn off colum generation
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            //Define first name column
            DataGridViewTextBoxColumn firstNameColumn = new DataGridViewTextBoxColumn
                DataPropertyName = "first_name",
                HeaderText = "First Name",
                ValueType = typeof(string)
            //Define last name column
            DataGridViewTextBoxColumn lastNameColumn = new DataGridViewTextBoxColumn
                DataPropertyName = "last_name",
                HeaderText = "Last Name",
                ValueType = typeof(string)

            //Add Columns to data grid

        private void friendList1_FriendSelected(object sender, Facebook.Winforms.FriendSelectedEventArgs e)
            //Get selected user object and pass to display

        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
            //Get Selected user object and pass to display
            if (dataGridView1.SelectedRows.Count <= 0) return;
            user selectedUser = dataGridView1.SelectedRows[0].DataBoundItem as user;

        private void DisplayUserDetail(user selectedUser)
            //Ignore during initial load
            if (_isLoading) return;

            //Load User Specific details
            MessageBox.Show("User ID:", string.Format("{0}",selectedUser.uid, selectedUser.status));
             Facebook.Schema.user user = facebookService1.Users.GetInfo(selectedUser.uid);
            long? userid = selectedUser.uid;
            long StatusUID = unchecked((long)userid);
            Facebook.Schema.user_status message = user.status;
            MessageBox.Show("User ID : " + (string.Format("{0}", selectedUser.uid)) + "Message: " + message );               


        private void btnStatus_Click(object sender, EventArgs e)
                //Update Facebook Status and refresh form's status display
                txtNewStatus.Text = string.Empty;
            catch (Exception ex)
                txtCurrentStatus.Text = ex.Message;

        private void GetCurrentStatus()
            //Recieve and display the current user's Status
            txtCurrentStatus.Text = facebookService1.Status.Get()[0].message;

        private void txtCurrentStatus_TextChanged(object sender, EventArgs e)

        private void btnExtPerm_Click(object sender, EventArgs e)

            Promt user for extended permission to update Facebook Status
             string extendedPermUrl=
             Opem with browser