简体   繁体   English

如何使用 c# SDK 从 facebook 获取新闻源

[英]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);
        }
    }

From googling, it looks like the response you get is most likley in JSON format.从谷歌搜索来看,您得到的响应似乎最有可能采用 JSON 格式。 See the following blog post:请参阅以下博客文章:

http://facebooksdk.blogspot.com/2011/05/facebook-status.html 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?为什么不直接添加断点并从 Visual Studio 中探索返回的事件参数?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM