php - Gmail API getting all Gmail Inbox messages limits to 500 -
i trying inbox messages in gmail api, it's limiting 500 per request. messages, , current messages in repository 1600+ able 500 on 1 request.
$service = new google_service_gmail($client); $user = 'me'; $params = array( 'labelids' => 'inbox', 'maxresults' => 20000 ); $last_date = mysqli_fetch_array($query); extract($last_date); $date = date_create($latest); $date->modify('-1 day'); $filter_date = date_format($date, 'y/m/d'); $params['q'] = 'in:inbox after:'.$filter_date ; $messages = $service->users_messages->listusersmessages( $user, $params ); $list = $messages->getmessages(); //$list has 500 messages returned me.
just add clarity, what's happening. performed users.messages: list fetches 1600+ messages. i'm pretty sure gmail fetched 1600+ messages can display 500 messages @ time.
if want access next 501-1000 messages, need use nextpagetoken
comes every successful response. goes on next 1001-1500 messages , forth.
you can read nextpagetoken
mentioned here in gmail request body
Comments
Post a Comment