We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

Share a Work Item Query

You can share a work item query from Team Explorer or Team Web Access by sending it in an e-mail message or by storing it in a file that you can share. Also, you can build a hyperlink that runs a work item query and then share the hyperlink. For information about how to build a query to find work items in Team Foundation, see Finding Bugs, Tasks, and Other Work Items

If you receive an e-mail message to which a work item query is attached, you can run the query to display the specific work item or work items that the query identifies. To open and run the query, you must use a computer that has Team Explorer installed. If Team Explorer is connected to a different server than the one that the attached query references, when you open the query, Team Explorer closes the current connection and establishes a connection with the server that the query references.

In this topic

Required Permissions

To perform these procedures, you must be a member of the Readers group or have the View work items in this node permission set to Allow for the team project that the attached query references. Other restrictions may apply. For more information, see Organize and Set Permissions on Work Item Queries and Team Foundation Server Permissions.

To copy a query and send it by using an e-mail application

  • Follow one of these steps:

    • In Team Web Access, open the query that you want to send, and copy the URL from the address bar of the browser.

    • (With Office Outlook configured) In Team Explorer, right-click the query that you want to send, and then click Open in Query Send to Microsoft Outlook

    • In your e-mail application, create an e-mail message, and paste the query into it.

    • In Team Explorer, right-click the query that you want to send, and then click Copy. In your e-mail application, create an e-mail message, and paste the query into it.

To open a query that was sent to you in e-mail

  1. On a computer that has Team Explorer installed, use your e-mail program to open the message to which the query is attached.

  2. If you are using Office Outlook, double-click the attachment to open it. If you use another e-mail program and are unsure how to open an attachment, see the Help for your e-mail program.

    The query runs in Team Explorer and displays results.

  3. (Optional) If you want to save the query for later use, on the File menu, click Save QueryName.wiq [Editor] As.

    For more information, see Save, Copy, Rename, and Delete Work Item Queries.

To save a query as a file by using Team Explorer

  1. In Team Explorer, right-click the query that you want to send, and then click Edit Query.

  2. On the File menu, click Save QueryName [Editor] As.

    The query is saved with the .wiq file extension.

  3. Under Select the query type and save location, click File.

    If you want to save the query file in a folder other than the default location, click Browse, and specify the folder.

  4. Click Save.

    You can attach the saved file to an e-mail message, copy the file to a shared folder, or modify the file with a text editor, such as Notepad.

To create a hyperlink that runs a query

  1. Construct a link that matches one of the following templates:

    Team Web Access

    http://ServerName:Port/Path/web/q.aspx?pname=Project&wiql=WorkItemQueryLanguage

    Example:

    http://AdventureWorks:8080/tfs/web/q.aspx?pname=AdventureWorksProject&wiql=SELECT [System.ID], [System.Title], [System.State] FROM WorkItems WHERE [System.TeamProject]='AdventureWorksProject' AND [System.WorkItemType]='Bug' AND [System.FoundIn]='9.0.30304' http://Server1:8091/tfs/web/wi.aspx?id=9035

    Team Explorer

    http://ServerName:Port/Path/q.aspx?pname=Project&wiql=WorkItemQueryLanguage

    Example:

    http://AdventureWorks:8080/q.aspx?pname=AdventureWorksProject&wiql=SELECT [System.ID], [System.Title], [System.State] FROM WorkItems WHERE [System.TeamProject]='AdventureWorksProject' AND [System.WorkItemType]='Bug' AND [System.FoundIn]='9.0.30304'

    where:

    • ServerName specifies the name of the server that is running Team Foundation Server.

    • Port specifies the port that Team Foundation Server uses. The default value is 8080.

    • Path specifies the directory location where Team Foundation Server is installed.

      NoteNote

      Team Web Access is installed in the subdirectory labeled "web" directly below the directory where you have installed Team Foundation Server.

    • Project specifies the name of the team project that is the target of the query.

    • WorkItemQueryLanguage is a SQL-like language that you can use to query programmatically for work items.

    In the previous examples, the URL runs a query on the AdventureWorks server, port 8080, against the AdventureWorksProject project, and returns the ID, title, and state of all bugs that have build number 9.0.30304.

    NoteNote

    If you are not familiar with work item query language, you can create an example by saving a new or existing query as a .wiq file. For specific steps, see Saving a Query as a File Using Team Explorer. You can then open the file in a text editor such as Notepad, modify the query language to meet your needs, and then copy it into the hyperlink. For more information about the query syntax language, see Query for Bugs, Tasks, and Other Work Items.

  2. Share the hyperlink by copying it to an e-mail message, or encoding it on a Web page or a software application form.

Show: