Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / All-Topics

Searching in VSTS/TFS

5.00/5 (3 votes)
6 Aug 2017MIT3 min read 7.3K  
A cool feature of Chrome and how you can be more productive with VSTS search

This post is largely showing off a cool feature of Chrome but the core focus is how you can be more productive with VSTS search. Open-mouthed smile

Visual Studio Team Services lets you search across all your code and work items. What's really strange about this is how without this functionality, it was harder trying to find work items and code, but I used to say it would be nice if we had a better work item search and it would be nice to have a code search instead of having to pull all the code to my machine. I now find myself saying, why isn't it as easy as searching Google.

image

Well it is Open-mouthed smile, I don't often notice features like this search because I used to just type what I want in the address bar and hit enter, switching between search engines was a process of copy, navigate to other search engine and paste. One day, I saw a friend of mine Rory Bolle have a search bar like the image above and my life changed as he showed me this feature Smile. Part of getting through each day generally has a lot of how can I be more efficient with boring tasks, and although not really a task on its own browsing to where to search is boring and something you don't have to do Smile.

Searching VSTS Faster Using Chrome

Chrome supports custom search engines and that's what functionality we going to use now. Open Chrome settings:

image

Scroll down to the Search engine section and then click on Manage search engines:

image

under the Other search engines section, click ADD.

image

We are going to add 2 search engines here, first for code search (replace your account name in the URL).

Search engine: TFS Code Search

Keyword: tfsc

Url:

  • VSTS: https://<your account name>.visualstudio.com/_search?type=Code&lp=search-account&text=%s&_a=research
  • TFS: https://<server>:<port>/tfs/<team project collection>/_search?type=Code&lp=apps-account&text=%s&_a=contents

image

Repeat that process again, this time for work item search.

Search engine: TFS Work Item Search

Keyword: tfsw

Url:

  • VSTS: https://<your account name>.visualstudio.com/_search?type=Work%20item&lp=apps-account&text=%s&_a=search
  • TFS: https://<server>:<port>/tfs/<team project collection>/_search?type=Work%20item&lp=apps-account&text=%s&_a=research

You should now have these 'search engines' in your list and you can use this in your browser:

image

In the browser bar, type tfsw and then space bar and search for something like test.

image

And press enter:

image

This will go ahead and perform a work item search on your account for the phrase that you typed in. Try the same thing with the tfsc shortcut:

image

As you can see, this then obviously searches your code. Smile

image

Conclusion

Firstly, you don't need to do those extra navigations to get to a page where you can search, it's super easy to just use what your browser has built in.

Secondly, chrome's search engines functionality can be used for any site, basically just take a url and replace the 'search term' part of the url with %s. For example, in my list, I generally have the .NET Framework Reference Source (https://referencesource.microsoft.com/#q=%s) to easily find .NET source.

image

which conveniently brings up:

image

Cheers and have fun searching! Open-mouthed smile

License

This article, along with any associated source code and files, is licensed under The MIT License