How paging works in C # Facebook sdk

Cannot find documentation for this ...

The following code is currently used to get a list of my photos:

FacebookApp fb = new FacebookApp(accessToken);
dynamic test = fb.Get("me/photos");

I look at the first 25 photos that he returns. Plain.

Now, how to do this to return the next 25?

So far I have tried this:

FacebookApp fb = new FacebookApp(accessToken);
string query = "me/photos";

while (true)
{
    dynamic test = fb.Get(query);

    foreach (dynamic each in test.data)
    {
        // do something here
    }

    query = test.paging.next;
}

but it does not work:

Could not parse '2010-08-30T17%3A58%3A56%2B0000' into a date or time.

Should I use a new variable dynamicfor each request, or will I completely change that?

+5
source share
2 answers

Finished finding this:

// first set (1-25)
var parameters = new ExpandoObject();
parameters.limit = 25;
parameters.offset = 0;

app.Api("me/friends", parameters);

// next set (26-50)
var parameters = new ExpandoObject();
parameters.limit = 25;
parameters.offset = 25;

app.Api("me/friends", parameters);
+10
source

I also found that you can use this.

// for the first 25 albums (in this case) 1-25
dynamic albums = client.Get("me/albums", new { limit = "25", offset = "0"});

// for the next 25 albums, 26-50
dynamic albums = client.Get("me/albums", new { limit = "25", offset = "25"});

Worked the same way as you used above.

+5
source

All Articles