I am trying to find some information on how to page data in the Microsoft Graph gem? Specifically paging over messages in a folder. There does not appear to be a PageIterator in the gem (similar to the c# implementation) to help with paging over the data. I see that there is a top and skip method in the request builder, but that seems to be completely ignoring the odata_next_link returned in the first request. Any help would be greatly appreciated.
My code is currently looking like this and using the top and skip and returns duplicate messages:
begin
params = MicrosoftGraph::Users::Item::MailFolders::Item::Messages::Delta::DeltaRequestBuilder::DeltaRequestBuilderGetQueryParameters.new
params.select = %w[sender subject body from toRecipients sentDateTime ccRecipients]
params.filter = "receivedDateTime ge 2025-06-04T00:00:00Z"
params.skip = 0
params.top = 100
request_configuration = MicrosoftKiotaAbstractions::RequestConfiguration.new
request_configuration.query_parameters = params
delta_request_builder = inbox_request_builder.messages.delta
messages_fiber = delta_request_builder.get(request_configuration)
while (messages_response = messages_fiber.resume)
messages_response.value.each do |message|
messages[message.id] = message
end
# next page
params.skip += params.top
messages_fiber = delta_request_builder.get(request_configuration)
end
rescue FiberError
# Noop
end
The message_response in this contains a odata_next_link property which is the url for the next page... but how do you feed that back in the ruby library?
There seems to be no information on the gem or Microsoft docs on how this should work.