如何获得带有生日信息的Facebook好友列表?

时间:2014-07-18 05:28:15

标签: c# facebook windows-phone-8

作为wp8应用程序开发的一部分,我们需要在我们的应用程序中显示Facebook好友列表,因为我们在wp8中使用FacebookClient。 fb.GetTaskAsync(" /我的/朋友的字段= ID,生日");我们使用这种方法来获取朋友列表主要是我们需要每个朋友的名字,身份证,生日,图像。但我们只得到那个id和名字。请看下面的代码

 FacebookClient fb = new FacebookClient(App.AccessToken);

        fb.GetCompleted += (o, e) =>
        {
            if (e.Error != null)
            {
                Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message));
                return;
            }

            var result = (IDictionary<string, object>)e.GetResultData();

            var data = (IEnumerable<object>)result["data"]; ;


            Dispatcher.BeginInvoke(() =>
            {


                foreach (var item in data)
                {
                    var friend = (IDictionary<string, object>)item;

                    FacebookData.Friends.Add(new Friend { Name = (string)friend["name"], id = (string)friend["id"], PictureUri = new Uri(string.Format("https://graph.facebook.com/{0}/picture?type={1}&access_token={2}", (string)friend["id"], "square", App.AccessToken)) });
                }

                NavigationService.Navigate(new Uri("/Pages/FriendSelector.xaml", UriKind.Relative));
            });

        };


        fb.GetTaskAsync("/me/friends?fields=id,name,birthday");

2 个答案:

答案 0 :(得分:3)

简单回答:由于

,使用Graph API v2.0无法做到这一点

答案 1 :(得分:-1)

在您用于检索信息的任何环境中使用Opengraph API。生日在链接

下面的用户信息对象视图中

https://developers.facebook.com/docs/graph-api/reference/v2.0/user