Creating a query variable in TFS

We have a requirement to pass a custom query variable to filter TFS records by executing a stored TFS query.

As we have @Me, @Project, @Today and [Any], we can use a custom variable like below, if so how can we do it or is there a better approach for this.

UserEmailAddress = @EmailAddress

to get records that match @EmailAddress that is passed from the C # source and we'll add a variable and trigger the stored TFS request.

var variables = new Dictionary<string, string>() { { "project", "ESE_Proj" },  {"EmailAddress",  "test} };

wiQuery = new Query(wiStore(), query.QueryText, variables);

wiTrees = wiQuery.RunLinkQuery();


The name of the work item type field, we have created the work item types, for example, the example Person is a work item type with a UserEmailAddress field in it. I want to create a request in tfs so that the user can invoke the request from C # by passing in the email address, taking it from the textbox and running the request for the entered email address -


source to share

2 answers

You will not be able to save the request to TFS. While you can create and use your own variables in C # with the TFS API, they don't understand them.

You can only use @me, @project, @today and @currentiteration in the saved request.



Okay, got it. Because the query is also used by the rest of the command in the command explorer. I left @project there, but when I need it, I'll replace @project with the actual name of the project.



All Articles