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

Question about NextLink #30

Closed
DmitriyVTitov opened this issue Nov 26, 2021 · 3 comments
Closed

Question about NextLink #30

DmitriyVTitov opened this issue Nov 26, 2021 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@DmitriyVTitov
Copy link

Hi!
I'm trying to use Go Graph SDK and I'm stuck! I am able to request AD users but I get only first 100 users with NextLink property which contains link to additional data.
How should I use this link to fetch next 100 users with Go SDK?
Example of my code:

	...
	client := msgraphsdk.NewGraphServiceClient(adapter)
	result, err := client.Users().Get(&opts)
	if err != nil {
		log.Fatal(err)
	}
	var users []graph.User
	users = append(users, result.GetValue()...)
	fmt.Println(*result.GetNextLink())
@baywet baywet self-assigned this Nov 26, 2021
@baywet baywet added question Further information is requested Needs author feedback labels Nov 26, 2021
@baywet
Copy link
Member

baywet commented Nov 26, 2021

Hi @DmitriyVTitov
Thanks for reaching out, and for trying the new SDK!

        client := msgraphsdk.NewGraphServiceClient(adapter)
	result, err := client.Users().Get(&opts)
	if err != nil {
		log.Fatal(err)
	}
	var users []graph.User
	users = append(users, result.GetValue()...)

        page2, err := users.NewUsersRequestBuilder(*result.GetNextLink(), adapter).Get(nil)

Would give you page 2.
Alternatively, if you want all the pages, you can look as long as the next link is not nil.

Note: users is an import of github.com/microsoftgraph/msgraph-sdk-go/users

We also have a feature on the roadmap to iterate automatically over the pages and call a function you'd provide. Please go upvote the item if you think that'd be useful to you.

Let us know if you have any additional question.

@DmitriyVTitov
Copy link
Author

DmitriyVTitov commented Nov 26, 2021

Thanks @baywet!
Is the SDK production ready or it's going to change significantly?
Close this issue please.

@baywet
Copy link
Member

baywet commented Nov 26, 2021

This really depends on you (the broader community), the more people we get to try the SDK, and the more positive feedback we get, the faster this SDK will reach GA in its current shape.
If on the contrary we don't get a lot of people to try the SDK, or get a lot of feedback that things need to change, it'll take longer to reach GA and/or we'll need to make significant changes before it does.

At this very moment, assuming the feedback is on the positive side, the only major change we anticipate is the move of the kiota dependencies to their own repository, this should be a quick change for most people, a reference update. (github.com/microsoft/kiota/abstractions/go, github.com/microsoft/kiota/serialization/go/json, github.com/microsoft/kiota/http/go/nethttp, github.com/microsoft/kiota/authentication/go/azure).

The other dependency we have that's currently in preview is azure identity.

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