Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use @odata.nextLink in graph client sdk to get the next set of messages. #415

Open
MN-Dheeraj opened this issue Mar 5, 2024 · 2 comments
Labels
question Further information is requested

Comments

@MN-Dheeraj
Copy link

I am using Graph client SDK (com.microsoft.graph.microsoft-graph:6.2.1) to read all messages in a channel.

Here is my code.
ChatMessageCollectionResponse result = getGraphClient().teams().byTeamId(teamsId).channels()
.byChannelId(channelId).messages().get(rc -> {
rc.queryParameters.top= 50;
rc.queryParameters.skip= 0;
});
chatMessages = result.getValue();

I know that I get only 50 records. But, I need to use @odata.nextLink somehow to make call to get next set of messages as well.
I don't want to take @odata.nextLink and make a rest call manually as I will need token again manually.
Is there a way I can modify my code to make multiple calls using different url every time.

@davidmoten
Copy link
Owner

You are using the Microsoft client, not odata-client-msgraph so why are you are putting your question here?

@davidmoten
Copy link
Owner

Note that if you use odata-client-msgraph the interaction is a lot simpler (paging is handled for you under the covers):

long count = client.teams(teamId).channels(channelId).messages().stream().count();

@davidmoten davidmoten added the question Further information is requested label Mar 5, 2024
@davidmoten davidmoten added enhancement New feature or request and removed enhancement New feature or request labels May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants