The user friend list return no data only summary with total friend count. I am working on a web application which will fetch logged in user face book friend list and then use their birthday to post birthday message in their profile.
Is there a way I can invite the Facebook friend and then access the user friend list because it is a web application.
enter code here
private List<Person> GetPersonFriendList(string access_token,string id)
{
List<Person> friendList = new List<Person>();
string url;
#region JSON.Net Friends
//Friends URL
url = "https://graph.facebook.com/v3.2/" + id + "/taggable_friends?access_token=" + access_token;
JObject myFriends = JObject.Parse(requestFBData(url));
//string id = "";
//string name = "";
//Loop through the returned friends
foreach (var i in myFriends["data"].Children())
{
Person friend = new Person();
friend.id = i["id"].ToString().Replace("\"", "");
friend.name = i["name"].ToString().Replace("\"", "");
friendList.Add(friend);
}
return friendList;
#endregion
}
private static string GetFacebookUserJSON(string access_token) { string url = string.Format(" https://graph.facebook.com/me?access_token= {0}&fields=email,name,first_name,last_name,link", access_token);
WebClient wc = new WebClient();
Stream data = wc.OpenRead(url);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();
return s;
}
taggable_friends
is deprecated: https://developers.facebook.com/docs/graph-api/reference/user/taggable_friends/
This edge was deprecated on April 4th, 2018 and now returns an empty data set.
There is no way to access the whole friendlist anymore, you can only get a list of users who authorized your App too, with /me/friends
.
...use their birthday to post birthday message in their profile
A friend would need to authorize your App with the user_birthday
permission for that. Rule of thumb: No data at all from any user without his explicit authorization/permission.
Also, posting on the wall of another user is not possible since a very long time and would be spam - you are not allowed to autopost or prefill anyway. Last but not least, you cannot even post to your own wall anymore, because publish_actions
was deprecated too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.