Limiting the AssignedTo dropdown-population for Team Foundation Server workitems

// August 2nd, 2006 // .Net, Team Development, Team Foundation Server

The Situation

You are running multiple Team Foundation Server projects with different developers working on different projects. All of the projects use the MSF Agile process. When a workitem is created (Task, Bug, etc.) you are able to assign a workitem to a designated user. The UI contains with a dropdown which is filled with all TFS users, not just the projectmembers. Furthermore you find it undesirable that new workitems are assigned to the creator by default.

Desired situation

When selecting a person to assign a workitem to, the dropdown is filled with persons assigned to the project’s Contributors or Project Administrator group. New workitems are assigned to no one in paticular. Both new and current projects should work this way.

Steps to get there

Download the process template for MSF Agile using the Process Template Manager.
Modify the files Bug.xml, QoS.xml, Risk.xml, Scenario.xml and Task.xml (located in the "MSF for Agile Software Development - v4.0\WorkItem Tracking\TypeDefinitions" directory) such that

<FIELD name="Assigned To" refname="System.AssignedTo" type="String">
   <VALIDUSER/>
</FIELD>

is changed into

<FIELD name="Assigned To" refname="System.AssignedTo" type="String">
   <ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
      <LISTITEM value="[Project]\Project Administrators" />
      <LISTITEM value="[Project]\Contributors" />
      <LISTITEM value="Unassigned" />
   </ALLOWEDVALUES>
   <DEFAULT from="value" value="Unassigned" />
 </FIELD>

The syntax of ALLOWEDVALUES, LISTITEM and DEFAULT as well as some info on expansion can be read in the MSDN Library. After you’ve added users or groups to the project groups don’t forget to do a refresh of the project before opening a workitem, otherwise the list isn’t populated correctly, I think that expanding of the lists is done on the server, not on the client.

To correct any pre-existing projects you’ll have to use the witimport tool to update the template files in each project. So for all your projects you have to run the following commands in a command window (ofcourse substituting the placeholders for your own TFS ServerName and ProjectName):

witimport /t <TFS ServerName> /p <ProjectName> /f <fullPathToModifiedFile>\Bug.xml
witimport /t <TFS ServerName> /p <ProjectName> /f <fullPathToModifiedFile>\QoS.xml
witimport /t <TFS ServerName> /p <ProjectName> /f <fullPathToModifiedFile>\Risk.xml
witimport /t <TFS ServerName> /p <ProjectName> /f <fullPathToModifiedFile>\Scenario.xml
witimport /t <TFS ServerName> /p <ProjectName> /f <fullPathToModifiedFile>\Task.xml

Again, remember to refresh any running Team Explorer instances to receive the changes on the client machines.

4 Responses to “Limiting the AssignedTo dropdown-population for Team Foundation Server workitems”

  1. tom says:

    - Is [Project] a TFS keyword for all projects or do you mean the current project name?
    - Which file must be modified? Each project file or is there a global file for this settings?

  2. Edward says:

    Hi Tom,
    [Project] should be replaced by the current project name.
    The files mentioned in the beginning of the post should be modified, so: “Bug.xml, QoS.xml, Risk.xml, Scenario.xml and Task.xml (located in the “MSF for Agile Software Development – v4.0\WorkItem Tracking\TypeDefinitions” directory)”

    Hope this helps

  3. tom says:

    Thanks for your answer.
    With this solution i must modify each file set (Bug.xml, QoS.xml, Risk.xml, Scenario.xml and Task.xml) for each current project in TFS, with the set of active directory people who are involved to this project. (and another set of people who are involved to another project. We have many projects.
    No GUI, no user mapping etc. I can believe it ….
    We are using TFS 2008, has TFS 2010 the same restrictions?

  4. Tom,
    The same restriction is true for 2010. The points that the Team Project Template can be seen as the blueprint of all your projects. Once a project is instantiated, it is the same as with a c# class. You can manipulate only one instance at the time ;-)

    Now I understand your issue, since I have experienced the same for all our process template upgrades we do for our software factory. It is just a matter of building a simple UI that iterates all projects, select the once you want to upgrade to your new definition and then issue commands against the TFS API for each project to update the Work Item definitions.
    So there is a solution to the problem. Send me an email through my blog (http://blogs.infosupport.com/marcelv) and I will give you the details how you can automate this.

Leave a Reply

PHVsPjxsaT48c3Ryb25nPndvb19hYm91dDwvc3Ryb25nPiAtIDwvbGk+PGxpPjxzdHJvbmc+d29vX2Fib3V0bGluazwvc3Ryb25nPiAtICM8L2xpPjxsaT48c3Ryb25nPndvb19hZHNfcm90YXRlPC9zdHJvbmc+IC0gdHJ1ZTwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2ltYWdlXzE8L3N0cm9uZz4gLSBodHRwOi8vd3d3Lndvb3RoZW1lcy5jb20vYWRzL3dvb3RoZW1lcy0xMjV4MTI1LTEuZ2lmPC9saT48bGk+PH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