This project is read-only.


Limit number of photo's from an album?


Is there a limit to the number of photo's you can retrieve from an album? If I do a count off of the album I get the actual photo count which is expected, but if I iterate through the collection not all of the photos are returned. The max seem to be 25 photos.
// max returned here is 25, even though selectedAlbum.count = 100 photos. I have tried this on a number of albums
    IList<Facebook_Graph_Toolkit.GraphApi.Photo> albumPhotos = selectedAlbum.GetPhotos(Api.AccessToken);
    foreach (Facebook_Graph_Toolkit.GraphApi.Photo photo in albumPhotos) {
Is there a way to get the next 25 and next 25 and so on until we reach the end of the album?

file attachments


kayson wrote May 11, 2011 at 2:38 PM

This is because the default number of photos returned by the Graph Api is 25. You can alter this value by passing a "limit" parameter to the Graph Api, i.e. by fetching{something}?limit=100 for example. Every Graph Api call supports the [limit] parameter. To keep the code of the Toolkit simple and easy to maintain, the implementation of this has been skipped, so the default number of items is always returned. Yon can modify the source code of the Toolkit to support limit and paging if you want.

Another option is to use FQL, which returns all information of the query most of the time (exceptions include querying events, which by default only returns events in the pass two weeks or something like that). You can also specify how many items to return in the FQL by using the LIMIT keyword.

wrote May 12, 2011 at 10:26 PM

ZiggyUK wrote May 12, 2011 at 10:26 PM

Good day, I have modified the source compiled and got it working with limit and offset. Setting these two values allows your application to then implement the paging that I required.
    IList<Facebook_Graph_Toolkit.GraphApi.Photo> albumPhotos = selectedAlbum.GetPhotos(Api.AccessToken, 30, 0);
// where 30 is the total number of photo's you want to initially fetch and 0 is the offset.
//So if I had a collection of 100 photo's I would probably do the following:
// GetPhotos(Api.AccessToken, 25, 0), then store the 25 for reference later, the next time i would run the query it would be something like this:
// GetPhotos(Api.AccessToken, 25, 25) and so, until I had reached the limit of the Album.count parameter.

I have also attached the two files that I modified for reference.

wrote May 12, 2011 at 10:27 PM

ZiggyUK wrote May 12, 2011 at 10:27 PM

and the second file.

wrote Jul 19, 2011 at 7:01 AM

wrote Feb 14, 2013 at 7:29 PM

wrote May 16, 2013 at 9:43 AM

wrote May 16, 2013 at 9:43 AM

wrote Jun 14, 2013 at 8:04 AM