Jerome Royal
Jerome Royal

Reputation: 1

How to get newsfeed from facebook using c# SDK

I have the following method to retrieve feeds from my profile. The main problem is, I am not sure how to extract the feeds from the variable i got.

    private void RetrieveMyFeedsFromFacebook()
    {
        var fb = new FacebookClient(_accessToken);
        string details = "";
        try
        {
            fb.GetCompleted +=
            (o, e) =>
            {
                if (e.Error == null)
                {
                    var result = (IDictionary<string, object>)e.GetResultData();
                    //Dispatcher.BeginInvoke(() => lbFeeds.ItemsSource = details);
                }
                else
                {
                    Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message));
                }
            };
            fb.GetAsync("/me/feed");
        }
        catch (FacebookApiException ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

Upvotes: 0

Views: 1249

Answers (1)

ColinE
ColinE

Reputation: 70132

From googling, it looks like the response you get is most likley in JSON format. See the following blog post:

http://facebooksdk.blogspot.com/2011/05/facebook-status.html

Anyhow, if your above code works, but you are not sure of the response format. Why not just add a breakpoint and explore the returned event argumenst from within visual studio?

Upvotes: 1

Related Questions