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

Graph::ListUsers API Fails to Return IsDeletedInOrigin Property Value #150

Open
ParthaI opened this issue Feb 13, 2024 · 0 comments
Open

Comments

@ParthaI
Copy link

ParthaI commented Feb 13, 2024

Dear Team,

I wanted to share with you that we are currently utilizing the Graph::ListUsers API to enumerate the users available within an Organization.

However, we've encountered an issue where this API consistently returns a null value for the IsDeletedInOrigin property.

For a demonstration of this problem, you can execute the Go code provided below.

package main

import (
	"context"
	"log"

	"github.com/microsoft/azure-devops-go-api/azuredevops/v7"
	"github.com/microsoft/azure-devops-go-api/azuredevops/v7/graph"
	"github.com/turbot/go-kit/types"
)

func main() {
	organizationUrl := "Your Org URL"                        // todo: replace value with your organization url
	personalAccessToken := "xxxxxxxxxx" // todo: replace value with your PAT

	// Create a connection to your organization
	connection := azuredevops.NewPatConnection(organizationUrl, personalAccessToken)

	ctx := context.Background()

	// Create a client to interact with the Graph area
	graphClient, err := graph.NewClient(ctx, connection)
	if err != nil {
		log.Fatal(err)
	}

	input := graph.ListUsersArgs{}

	for {
		users, err := graphClient.ListUsers(ctx, input)
		if err != nil {
			log.Fatal(err)
		}

		for _, user := range *users.GraphUsers {
			log.Printf("Name = %v \n", *user.DisplayName)
			log.Printf("IsDeleted = %v\n", user.IsDeletedInOrigin)
			log.Printf("Origin = %v\n\n", *user.Origin)
		}
		continuationToken := *users.ContinuationToken
		if continuationToken[0] == "" {
			break
		}
		input.ContinuationToken = types.String(continuationToken[0])
	}
}

Could you please take a look and let me know if I am doing anything wrong here or if there is any other supported API version that will return the value for the property IsDeletedInOrigin?

Thanks!

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