Ejemplo n.º 1
0
        public static async Task<List<FacebookUser>> DownloadFriendsList()
        {
            WebClient client = new WebClient();
            string result = String.Empty;
            await new WebBrowser().ClearCookiesAsync();
            try
            {
                result = await Internet.DownloadStringAsync(client,
                new Uri(
                    "https://graph.facebook.com/" + 
                    "me/friends?fields=" +
                            "name," +
                            "picture," +
                            "installed" +
                    "&access_token=" + App.fbToken, UriKind.Absolute));
            }
            catch (Exception)
            { result = null; }

            if (result != null)
            {
                FacebookData data = new FacebookData();
                data = JsonConvert.DeserializeObject<FacebookData>(result);
                return data.friends;
            }
            else return null;
            
        }
Ejemplo n.º 2
0
        public static async Task<List<FacebookUser>> DownloadFriendsList()
        {
            HttpClient client = new HttpClient();
            string result = await client.GetStringAsync(String.Format(
                    "https://graph.facebook.com/{0}/friends?fields=name,about,picture&access_token={1}",
                    Utilities.fbUserID,
                    Utilities.fbToken));

            FacebookData data = new FacebookData();
            data = JsonConvert.DeserializeObject<FacebookData>(result);
            return data.friends;
        }