1

i am trying to access the facebook user information(education, hometown details) using graph api Is it possible to do this string url = "https://graph.facebook.com/me?fields=id,name,picture,bio,quotes,education,hometown&access_token=" + oAuth.Token;

 string json = oAuth.WebRequest(oAuthFacebook.Method.GET, url, String.Empty);
 UserInfo ui = js.Deserialize<UserInfo>(json);

 StringBuilder sb = new StringBuilder();
sb = sb.Append("Name : " + ui.name + "<br/>");
sb = sb.Append("<Img src='" + ui.picture + "' alt='' />");
sb = sb.Append("Bio : " + ui.bio + "<br/>");
sb = sb.Append("Quotes : " + ui.quotes + "<br/>");
//This does not work      sb = sb.Append("hometown : " + ui.hometown[0] + "<br/>");
//This does not work      sb = sb.Append("Education : " + ui.education[0] + "<br/>");

I the following UserInfo class

public class UserInfo
    {
        public string id { get; set; }
        public string name { get; set; }
        public string picture { get; set; }
        public string bio { get; set; }
        public string quotes { get; set; }
        public HometownInfo from { get; set; }

    }
    public class HometownInfo
    {
        public string id { get; set; }
        public string name { get; set; }
    }

Please give me some inputs.. I dont have a lot of experience in .net. Also, I understand that ui.hometown[0] is not the correct way to access the user Hometown info... Please correct me Thanks SC

1 Answer 1

1
public class FacebookUser
{
    public string    id { get; set; }
    public string  name { get; set; }
    public string about { get; set; }

    public string link { get; set; }
    public hometown hometown = new hometown();
}

public class hometown
{
   public string   id { get; set; }
   public string name { get; set; }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.