2

I've a tool(web application) which creates work-items in azure devops. (skipping the unnecessary details), just like how we assign any user a particular work-item from the Assigned To dropdown in azure devops, I too have a dropdown which when user enters any name/alias, a list of users starts showing based on the input. The api which I was using in the backend was https://abcorganization.vsaex.visualstudio.com/_apis/UserEntitlements?top=10&filter=name+eq+%27Tejas

Here filter=name+eq+%27Tejas in the query parameter helps to query the api and used to give set of users whose name starts with Tejas. It can be email alias too. But for some reason, that doesn't work anymore. My guess, they've deprecated that API version

So in my search to find the alternative/answer, I came across the following documentation: (https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/users/get?view=azure-devops-rest-5.1) in which the API given is: https://vssps.dev.azure.com/abcorganization/_apis/graph/users/{userDescriptor}?api-version=5.1-preview.1

Here the userDescriptor is some sort of unique key of AAD related to a particular user. (which I certainly can't use to fulfill my purpose).

The other thing which I've tried is the below query parameters but it still didn't worked out https://vssps.dev.azure.com/abcorganization/_apis/graph/users?subjectTypes={subjectTypes}&continuationToken={continuationToken}&api-version=5.1-preview.1

So is there anyway/api which can fullfil my purpose or is it that I'm using this new API in a wrong way or something? Any help would be much appreciated

TejasGondalia
  • 168
  • 3
  • 13
  • It still works for me. what do you mean "doesn't work anymore", do you get results without filtering? – Shayki Abramczyk Sep 26 '19 at 06:02
  • Wired... on my side it returns a filtering results. can you try `vsaex.dev.azure.com/organization` instead if `visualstudio.com...`? – Shayki Abramczyk Sep 26 '19 at 06:08
  • yes @ShaykiAbramczyk, I did tried that, still returns count zero. No exceptions raised – TejasGondalia Sep 26 '19 at 06:13
  • Maybe try to add `&api-version=5.0-preview.2` – Shayki Abramczyk Sep 26 '19 at 06:16
  • @ShaykiAbramczyk, although If I just hit https://abcorganization.vsaex.visualstudio.com/_apis/UserEntitlements, then it does give some set of users (but not any of them is a known one), and I did tried to search a number of known people but still no result (consider it's a big organization). So I definitely agree that this thing works for you, but in this case, that too in particularly this organization, this doesn't give me any result – TejasGondalia Sep 26 '19 at 06:19
  • @ShaykiAbramczyk, I was doubtful that maybe the users which I know have certainly moved somewhere else in aad, but as I showed in the question, that when I used the other API with user descriptor as parameter, it did gave me results. That's why I was asking there's any other API which takes a search parameter like that – TejasGondalia Sep 26 '19 at 06:25
  • I have the same query too. Is there a REST API in Azure DevOPS which we can invoke with a search parameter of say a user name or email to search for a list of users that matches? – Nikhil Sep 30 '19 at 21:42
  • @Nikhil, have you tried the API which is mentioned in the question? Did you replaced Tejas in the query parameter and tried? Because for some people, it still works – TejasGondalia Oct 01 '19 at 02:32
  • 1
    There are many ways in which this can still "work". For instance you can use IdentityHttpClient class which allows you to query/search for users using their email id or name against Azure DevOPS. The point though is that none of them seem to be supported anymore. Almost all of them are undocumented/unofficial workarounds or solutions on which MS has categorically stated that they are not supported. I am looking for the proper officially recommended way of doing it. – Nikhil Oct 04 '19 at 13:13
  • Is there a way to say not contains in URL form? – Andrew Gray Mar 10 '20 at 03:28
  • @AndrewGray, sorry I didn't understand your question. Could you elaborate a little? – TejasGondalia Mar 10 '20 at 04:36
  • Is there a way to express "not contain" in URL form? searchText seems to be "contains". I need "not contains" – Andrew Gray Mar 10 '20 at 04:39
  • Not exactly that I know of, but still hardly doubt whether this api will have that feature. Anyways, I think azure devops has changed the way they used to give data, they're using a different API (maybe graphQl). But still, I haven't followed up on this topic lately and you can only search microsoft docs for more info. – TejasGondalia Mar 10 '20 at 04:50

2 Answers2

1

I believe it should be $filter in the query. You are also missing the closing quote.

(See docs for more details)

https://abcorganization.vsaex.visualstudio.com/_apis/UserEntitlements?top=10&$filter=name+eq+'Tejas'

Victor
  • 2,450
  • 2
  • 23
  • 54
0

Use this. I tested it and worked for me: https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?$filter=name+eq+%27{name}%27&api-version=6.0-preview.3

Replace {organization} and {name} as needed

rkkreddy
  • 725
  • 1
  • 9
  • 16