我正在尝试使用C#开发桌面应用程序,用户可以通过电子邮件或姓名搜索一个人。然后,程序将列出用户的信息和公共相册或图片。然后,程序用户将查看照片,如果能找到正确的搜索对象,就会添加好友。
我的问题是我无法列出并显示公共相册。我尝试使用FQL和Graph API,但两者返回的数据都为空。我为此编写的代码如下:
我的问题是我无法列出并显示公共相册。我尝试使用FQL和Graph API,但两者返回的数据都为空。我为此编写的代码如下:
ArrayList pictureLink;
public void userPhotos(string userID)
{
var fb2 = new FacebookClient(_accessToken);
//result1 and result2 aren't using in code only for looking for with breakpoint
dynamic result1 = fb2.Get("fql", new { q = "SELECT aid,cover_pid FROM album WHERE owner=" + kisiID });
dynamic result2 = fb2.Get("fql", new { q = "SELECT pid,aid FROM photo WHERE owner=" + kisiID });
ArrayList imageSize; //for gettig highest pixell of picture
pictureLink = new ArrayList();
var fb = new FacebookClient(_accessToken);
//dynamic albums = fb.Get("me/albums"); // THİS code is rigth runnig
dynamic albums = fb.Get(userID + "/albums");
foreach (dynamic albumInfo in albums.data)
{
//Get the Pictures inside the album this gives JASON objects list that has photo attributes
// described here http://developers.facebook.com/docs/reference/api/photo/
dynamic albumsPhotos = fb.Get(albumInfo.id + "/photos");
foreach (dynamic rs in albumsPhotos.data)
{
imageSize= new ArrayList();
foreach (dynamic rsa in rs.images)
{
imageSize.Add(rsa.height);
}
int highestImage = Convert.ToInt32(imageSize[0]);
foreach (dynamic rsa in rs.images)
{
if (rsa.height == highestImage )
{
string link= rsa.source;
pictureLink.Add(link);
}
}
}
}
}