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 page through memberentitlementmanagement SearchUserEntitlements() results? #191

Open
jbiel opened this issue Feb 17, 2025 · 0 comments

Comments

@jbiel
Copy link

jbiel commented Feb 17, 2025

Does anyone have any examples of how to page through memberentitlementmanagement SearchUserEntitlements() results? According to the docs a ContinuationToken should be used for paging, but that's not exposed in return value that I can see. I originally posted a thread here and was redirected to the github issues for this project. Thanks!

package main

import (
	"context"
	"os"

	"github.com/microsoft/azure-devops-go-api/azuredevops/v7"
	"github.com/microsoft/azure-devops-go-api/azuredevops/v7/memberentitlementmanagement"
)

func main() {
	org := os.Getenv("AZURE_DEVOPS_ORGANIZATION_URL")
	pat := os.Getenv("AZURE_DEVOPS_PERSONAL_ACCESS_TOKEN")

	// Initialize the client
	connection := azuredevops.NewPatConnection(org, pat)
	client, _ := memberentitlementmanagement.NewClient(context.Background(), connection)

	// Create search args
	options := memberentitlementmanagement.SearchUserEntitlementsArgs{ContinuationToken: nil}

	// Get the current page of results
	response, _ := client.SearchUserEntitlements(context.Background(), options)

	// This is an invalid parameter. Where can I get it?
	if response.ContinuationToken != nil {
		// we have all responses
	} else {
		// need to get the next page
	}

}
@jbiel jbiel changed the title How to page through github.com/microsoft/azure-devops-go-api/azuredevops/v7/memberentitlementmanagement results? How to page through memberentitlementmanagement SearchUserEntitlements() results? Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant