azure-devopsodata

Azure Devops odata query returns UserEmail:Unknown


I'm trying to get a list of WorkItems together with the assignees. However no matter what I try, I get this output:

{
"@odata.context":"https://tfs.akbank.com/DefaultCollection/AkbankIT/_odata/v3.0-preview/$metadata#WorkItems(WorkItemId,AssignedTo(UserName,UserId,UserEmail,UserType),Teams(TeamName))",
"value":[
{"WorkItemId":3010036,
"AssignedTo":{
    "UserId":"aa490a50-14cb-4282-92ab-f4facddcfcfc",
    "UserName":"John Doe (John's Department)",
    "UserEmail":"Unknown",
    "UserType":null
    },
"Teams":[{"TeamName":"MyTeam"}]}]}

When I open the WorkItem in the UI, I can see the person it's assigned to. What can be the problem?

I check the API documentation and SO for AD Odata questions with no luck.

Here is the odata url I'm trying: https://tfs.akbank.com/DefaultCollection/AkbankIT/_odata/v3.0-preview/WorkItems?$select=WorkItemId&$expand=AssignedTo($select=UserName, UserId, UserEmail, UserType), Teams($select=TeamName)&$filter=WorkItemId eq 3010036


Solution

  • With your Odata structure, I can reproduce the same on my On-prem DevOps server:

    enter image description here

    The issue should be caused by the account itself, since the user comes from local machine/domain, it could not have email configured, which results it cannot get the email info.

    You can get the account details by its id to confirm if it contains the email.

    enter image description here

    I also tried same Odata in Cloud service(change to https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}), confirmed the email display well.

    enter image description here

    Edit:

    As we confirmed, your identity has email value, but cannot return from odata url. It's recommended to report it in Developer Community. Thanks.