microsoft/azure-devops-go-api

Graph::ListUsers API Fails to Return `IsDeletedInOrigin` Property Value

ParthaI opened this issue · 0 comments

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!