Facebook Retrive Data using Graph API using C #

I created a desktop application using C # .net. I want to get the history of user messages, messages and chats. which is a convenient way for users to get all the information. I started with the Facebook Graph API, but I am not getting any example.

Can someone help me?

+3
source share
5 answers

Go to developer.facebook.com โ†’ Tools and Support โ†’ Select Interactive API.

Here U receives FQL request, access token

Then write the code in C # .....

var client = new FacebookClient();
client.AccessToken = Your Access Token;

//show user profile picture
dynamic me = client.Get("me?fields=picture");
pictureBoxProfile.Load(me.picture.data.url);

//show user birthday
me = client.Get("me/?fields=birthday");
labelBirthday.Text = Convert.ToString(me.birthday);
+3
source

, :

System.Net.Http Newtonsoft.Json

string userToken = "theusertokentogiveyoumagicalpowers";

using (var client = new HttpClient())
{
    client.BaseAddress = new Uri("https://graph.facebook.com");

    HttpResponseMessage response = client.GetAsync($"me?fields=name,email&access_token={userToken}").Result;

    response.EnsureSuccessStatusCode();
    string result = response.Content.ReadAsStringAsync().Result;

    var jsonRes = JsonConvert.DeserializeObject<dynamic>(result);

    var email = jsonRes["email"].ToString();
}
+1

" " Developer.facebook.com, "" " ", , , , "GET" "POST" FB Graph APis

0

, , webhooks ( ), . (FQL ). , .

API - , amt. .

FB , . - -. https://msdn.microsoft.com/en-us/library/bay1b5dh(v=vs.110).aspx

, JSON, JSON.NET. NUGEt.

0

Source: https://habr.com/ru/post/1681119/


All Articles