microsoft / azure-devops-dotnet-samples

.NET/C# samples for integrating with Azure DevOps Services and Azure DevOps Server
https://docs.microsoft.com/azure/devops/integrate
MIT License
523 stars 517 forks source link

using WorkItemExpand as flag does not work with WorkItemTrackingHttpClient.GetWorkItemAsync #271

Open spashx opened 5 years ago

spashx commented 5 years ago

Hi,

With Microsoft.TeamFoundationServer.Client.16.153.0 against Azure Devops Server 2019, using WorkItemExpand with a flag expression won't return relations.

ex:

// assuming this workitem has relations (relations between Workitems and a link to a commit)
int id =1234;

// this call will NOT return relations (wi.Relations is still null after call)
workItemTrackingHttpClient.GetWorkItemAsync(id, expand: WorkItemExpand.Links | WorkItemExpand.Relations).Result;

// this call will return relations.
workItemTrackingHttpClient.GetWorkItemAsync(id, expand: WorkItemExpand.All).Result

see your original example: https://github.com/microsoft/azure-devops-dotnet-samples/blob/8f341f8e33adc8b1b4432b51ad2e10f0b7864739/ClientLibrary/Samples/WorkItemTracking/WorkItemsSample.cs#L225

Maybe there is an issue into the WorkItemExpand enumeration definition ?

namespace Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models
{
    //
    // Résumé :
    //     Flag to control payload properties from get work item command.
    public enum WorkItemExpand
    {
        //
        // Résumé :
        //     Default behavior.
        None = 0,
        //
        // Résumé :
        //     Relations work item expand.
        Relations = 1,
        //
        // Résumé :
        //     Fields work item expand.
        Fields = 2,
        //
        // Résumé :
        //     Links work item expand.
        Links = 3,
        //
        // Résumé :
        //     Expands all.
        All = 4
    }
}
DynConcepts commented 4 years ago

Almost a year later... this issue is still open (just confirmed against DevOps Service with latest Nuget)....and not even a single comment...