I’m trying to integrate my app with Azure Devops for Ticket handling on there. For Creation of Work Item I wanted to know how I can check for list of assignees, if I wish to give manual input for assignee in ticket creation.
I tried using security namespace: 52d39943-cb85-4d7f-8fa8-c6baac873819 because I think this namespace for a project has access to read & write azure devops tickets. But I’m unable to find member of this security group and not too sure if this is the right approach either
Sanket Kar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
According to your description, you want to allow your user to select the correct assignee when manually entering the assignees name.
We can get the REST API which is used in the Azure DevOps UI by checking the network trace in Developer tools of Microsoft Edge.
For example, in the following screenshot, I searched the keyword “test”, and it will return the users contain the word.
Now, we get the Request URL: https://dev.azure.com/{orgname}/_apis/IdentityPicker/Identities
and the Request payload:
{
"query": "test",
"identityTypes": [
"user",
"servicePrincipal"
],
"operationScopes": [
"ims",
"source"
],
"options": {
"MinResults": 5,
"MaxResults": 40
},
"properties": [
"DisplayName",
"IsMru",
"ScopeName",
"SamAccountName",
"Active",
"SubjectDescriptor",
"Department",
"JobTitle",
"Mail",
"MailNickname",
"PhysicalDeliveryOfficeName",
"SignInAddress",
"Surname",
"Guest",
"TelephoneNumber",
"Manager",
"Description"
]
}
Here is the sample PowerShell script to call the API for your reference:
# Replace with your actual value
$organization = ""
$searchkeyword = "test"
$personalAccessToken = ""
# Create the request body
$requestBody = @"
{
"query": $searchkeyword,
"identityTypes": [
"user",
"servicePrincipal"
],
"operationScopes": [
"ims",
"source"
],
"options": {
"MinResults": 5,
"MaxResults": 40
},
"properties": [
"DisplayName",
"IsMru",
"ScopeName",
"SamAccountName",
"Active",
"SubjectDescriptor",
"Department",
"JobTitle",
"Mail",
"MailNickname",
"PhysicalDeliveryOfficeName",
"SignInAddress",
"Surname",
"Guest",
"TelephoneNumber",
"Manager",
"Description"
]
}
"@
# Define the API URL
$url = "https://dev.azure.com/$organization/_apis/IdentityPicker/Identities?api-version=5.0-preview.1"
# Create the headers
$headers = @{
"Content-Type" = "application/json"
"Authorization" = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$personalAccessToken"))
}
# Make the POST request
$response = Invoke-WebRequest -Uri $url -Method Post -Headers $headers -Body $requestBody
$jsonResponse = $response.Content | ConvertFrom-Json
# Output the formatted JSON response
$jsonResponse | ConvertTo-Json -Depth 10
Test result:
Note:
Since this API is not documented in the official documentation, the required access scope is not determined. Therefore, currently only a personal access token with full access scope can call this API.