TFS 2015 | TFS 2013
TFS 2017 and later versions no longer support native integration with Microsoft Project Server. If you upgrade to TFS 2017 or want to use a third party option, see Synchronize TFS with Project Server.
To synchronize data between an enterprise project plan and a team project, you must associate the work-item fields in Visual Studio Team Foundation Server (TFS) with the fields in Microsoft Project Server. You can add fields and specify how they synchronize by customizing the field mappings. You can map both built-in and custom fields in Project. For example, you can share data that does not relate to schedules (such as cost centers, team names, or health status) if you add the fields that store these types of data to the mappings.
You maintain one set of field mappings for each team project collection that hosts team projects that you want to synchronize with Project Server. You must define the field mappings for each team project collection that you have mapped to an instance of Project Web Access or Project Web App (PWA). You can upload the default mappings, or you can customize a mapping file and upload it. To upload the default mappings, see Upload Mappings later in this topic.
The mappings for the integration of TFS and Project Server are distinct from the mapping file for Microsoft Project. For more information, see Customize the Microsoft Project field mapping file.
As the following illustration shows, you customize the mappings in five steps:
Customizing the Field Mappings Between Team Foundation Server and Project Server
You can update the mapping file as often as you want. The fields that appear on the Project Server tab are updated for each type of work item that participates in data synchronization. You must not manually change the definitions for the Project Server tab. For more information, see Customize the Project Server Tab later in this topic.
For a demonstration video, see the following page on the Microsoft website: Managing Field Mappings for Integration of Team Foundation Server and Project Server.
To complete the procedures in this topic, you must have the Administer Project Server integration permission set to Allow. In addition, the TFS service account must be granted the Administer Project Server integration. For more information, see Assign permissions.
The mappings determine which fields get synchronized when a user updates information in TFS or Project Server. Each of the following synchronization types has its own set of mappings:
For publish synchronization, the data in Project Server updates the data in TFS. You use the targetToTfs element to specify the field in Project Server that updates the field in TFS.
For status synchronization, the data in TFS is submitted to the status queue in Project Server. You use the tfsToTarget element to specify the field that updates the status queue field in Project Server.
For more information about these two types of synchronization, see Synchronization process overview.
The following table lists the default set of fields that are mapped between TFS and Project Server. The table also indicates which types of work items use the fields based on the default process templates that TFS provides. You should not modify these mappings if you are mapping to a team project that was created from a process template that is based on Agile Software Development or Capability Maturity Model Integration (CMMI) Process Improvement. If you are mapping to a team project that was created from the Scrum process template, you will need to make some modifications as Required Changes to Make When Mapping to a Team Project That Was Created From the Scrum Process Template describes later in this topic.
For more information about mappings and the synchronization process, see Field mapping reference.
|Team Foundation field||Project Server field||Status Queue field||Work item types in Agile||Work item types in CMMI||Work item types in Scrum|
|Completed Work||Task Actual Work||Resource Actual Work||Task||Task||None|
|Remaining Work||Task Remaining Work||Resource Remaining Work||Task||Task||Task|
|Original Estimate||Baseline Work||Task||Bug, Change Request, Issue, Requirement, Risk, and Task||None|
|Start Date||Task Start||Resource Start||Task and User Story||Task and Requirement||None|
|Finish Date||Task Finish||Resource Finish||Task and User Story||Task and Requirement||None|
Required changes to make when mapping to a team project that was created from the Scrum process template
There are two changes you must make to enable data flow from a team project created from a Scrum process process template. You must add the Completed Work and Original Estimate fields to the Task work item type, and you must remove the elements that require the Remaining Work field to be empty when a team member changes the state to Done or Removed.
To update the Scrum task type definition
Open a Command Prompt window where either Visual Studio or Team Explorer is installed and enter:
cd %programfiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE
On a 32-bit edition of Windows, replace %programfiles(x86)% with %programfiles%.
To export the type definition for Task, type the following command, substituting your data for the arguments that are shown here, where CollectionURL specifies the URL of a team project collection, ProjectName specifies the name of a team project defined within the collection, and "DirectoryPath\FileName.xml" specifies the name and location for the file to export. Then choose Enter.
witadmin exportwitd /collection:CollectionURL /p:"ProjectName" /n:"Task" /f:"DirectoryPath\FileName.xml"
In a text editor or in Visual Studio, open the file you exported.
FIELDSdefinition section, add this code snippet before the element for Remaining Work:
<FIELD name="Completed Work" refname="Microsoft.VSTS.Scheduling.CompletedWork" type="Double" reportable="measure" formula="sum"> <HELPTEXT>The number of units of work that have been spent on this task</HELPTEXT> </FIELD> <FIELD name="Original Estimate" refname="Microsoft.VSTS.Scheduling.OriginalEstimate" type="Double" reportable="measure" formula="sum"> <HELPTEXT>Initial value for Remaining Work - set once, when work begins. </HELPTEXT> </FIELD>
<WORKFLOW>section, remove the following code snippet from both
<FIELD refname="Microsoft.VSTS.Scheduling.RemainingWork"> <EMPTY /> </FIELD>
<FORM>section, add the following
<Control FieldName="Microsoft.VSTS.Scheduling.OriginalEstimate" Type="FieldControl" Label="Original Estimate:" LabelPosition="Left" /> <Control FieldName="Microsoft.VSTS.Scheduling.CompletedWork" Type="FieldControl" Label="Completed:" LabelPosition="Left" />
Save and close the file.
Import the file, substituting your data for the arguments that are shown.
witadmin importwitd /collection:CollectionURL /p:"ProjectName" /f:"DirectoryPath\FileName.xml"
Refresh your team project or work items page to verify the changes.
Determine additional fields to map
Determine the following information for each field that you want to synchronize in addition to the default fields:
The reference name of the TFS field. If you want to synchronize a field in Project Server with a field that you must create in TFS, first create the field in each type of work item that you are synchronizing. For more information, see Index of work item fields and Modify a field or add a custom field.
The name of the field in Project Server that will update the TFS field. For a list of available fields, see Restrictions on mapping fields.
The name of the TFS field to be updated in Project Server and the name of the field in Project Server that will update the mirror field in TFS.
Whether to display the fields on the work item form. You set the value of the
truefor fields that you want to appear on the work-item form. You set the value of the
truefor work-item form.
Whether to resolve data conflicts by allowing the value of the TFS field to overwrite the value of the field in Project Server or to maintain both values. This decision determines the value of the
onConflictattribute. When onConflict=PsWins is set, the value of the field in Project Server overwrites the value of the field in Team Foundation. For more information, see Field Elements and Attributes.
Additional values that you must define to support pick lists or custom lookup tables in Project Server.
Restrictions on data that you can map
After you determine which fields you want to map, note the following restrictions:
You can send only task-level information, pjTask* fields, from Project Server to TFS.
You can send only resource-level information, pjResource* fields, from TFS to the status queue of Project Server.
The Title field is the only field that you can send both to TFS and to the status queue.
Rollup is automatically calculated for the Assigned To, Completed Work, and Remaining Work fields. You cannot map additional fields and have rollup calculated for them. For more information, see Work with resource rollup.
You must make sure that the data types or units of each field that you map conform to the field mapping criteria for standard and custom enterprise fields. For more information, see “Data Types and Field Mapping Criteria in Restrictions on mapping fields.
You can map fields that are associated with pick lists in TFS. However, you must create lookup tables in Project Server to match the pick lists. You cannot automatically synchronize pick lists and lookup tables.
For more information, see Restrictions on mapping fields.
Example: mapping the team name to appear in Project
In the following example, the custom string field in TFS, MyCompany.MyOrg.DevTeamName, is mapped to an enterprise custom text field in Project Server, My Company Team Name. You can use this example to display in Project Professional the name of the team that is associated with a task.
<field tfsName="MyCompany.MyOrg.DevTeamName" tfsMirrorName="Mirror.MyCompany.MyOrg.DevTeamName" displayTfsField="false" displayTfsMirror="false" onConflict="DoNothing"> <tfsToTarget> <target provider="ProjectServerStatusQueue" name=" My Company Team Name" /> </tfsToTarget> <targetToTfs> <target provider="ProjectServerPublished" name=" My Company Team Name" /> </targetToTfs> </field>
Neither field appears on the work item form. Also, if the values do not match, each field retains its own value.
Example: displaying the area and iteration paths in Project
You can map the Area (System.AreaPath) and Iteration (System.IterationPath) fields in TFS so that they appear in your project plans. Because these tree path fields change frequently, you should map them as text fields in Project. Project managers who use these fields must manually enter the full area path or iteration path.
The current implementation of TFS and Project Server integration does not support automatic synchronization of allowed value lists, pick lists, global lists, or tree path lists that are defined for mapped fields between the two server products. For the best experience, you must make manual entries in the project plan that match those in TFS. If you specify an entry that is not valid, a validation dialog box will appear when you publish the plan.
To add the Area and Iteration fields to a project plan, perform the following actions:
Add two customer enterprise fields to Project Server, and label them as Area (TFS) and Iteration (TFS).
For more information, see the following page on the Microsoft website: Creating Lookup Tables and Enterprise Custom Fields.
Export the field mappings from the team project collection where the team projects are defined.
For more information, see Download Mappings to a File later in this topic.
Add the following code to the file:
<field tfsName="System.AreaPath" tfsMirrorName="Mirror.System.AreaPath" displayTfsField="true" displayTfsMirror="true"> <tfsToTarget> <target provider="ProjectServerStatusQueue" name="Area (TFS)" /> </tfsToTarget> <targetToTfs> <target provider="ProjectServerPublished" name="Area (TFS)" /> </targetToTfs> </field> <field tfsName="System.IterationPath" tfsMirrorName="Mirror.System.IterationPath" displayTfsField="true" displayTfsMirror="true"> <tfsToTarget> <target provider="ProjectServerStatusQueue" name="Iteration (TFS)" /> </tfsToTarget> <targetToTfs> <target provider="ProjectServerPublished" name="Iteration (TFS)" /> </targetToTfs> </field>
Import the updated field mappings file as Upload Mappings describes later in this topic.
Synchronize your project plan with Project Server.
Add the two new columns for the new fields, Area (TFS) and Iteration (TFS), to your project plan
Changes made to the Area and Iteration fields in Team Foundation will be synchronized with these fields in your project plan. Also, you can update these fields in Project and publish your changes to Team Foundation if you specify values that have been defined in Team Foundation.
Download the mappings to a file
You can download mappings only from a team project collection to which they have been uploaded. If you want to download the default mappings to a file, you must first upload the default mappings, as described in To upload the default mappings later in this topic. As an alternative, you can copy the contents of the default mappings. For more information, see Field mapping reference.
To download the mappings to a file
To run the TfsAdmin command-line tool, open a Command Prompt window where either Visual Studio or Team Explorer is installed and enter:
cd %programfiles%\Microsoft Visual Studio 11.0\Common7\IDE
On a 64-bit edition of Windows, replace %programfiles% with %programfiles(x86)%..
Type the following command, and then choose Enter.
TfsAdmin ProjectServer /DownloadFieldMappings /collection:tpcUrl /filePath:MappingFile
Replace tpcUrl with the uniform resource locator (URL) of the team project collection, and replace MappingFile with the path and name of the file that you will customize.
Wait until the following messages appear:
Downloading MappingFile to Team Project Collection tpcUrl.
You have successfully downloaded field mapping file MappingFile to Team Project Collection tpcUrl.
Update the mappings
For each field that you want to add to the mapping file, you specify the
field element and its subelements and attributes. For more information, see Field mapping reference.
Upload the mappings
You upload mappings by using the UploadFieldMappings command. You can upload the default mappings by using the
/usedefaultfieldmapping option. Otherwise, you must specify a file that contains the mapping elements.
To upload the default mappings
At the command prompt, type the following command, and then choose ENTER.
TfsAdmin ProjectServer /UploadFieldMappings /collection:tpcUrl /usedefaultfieldmappings
Replace tpcUrl with the URL of the team project collection.
Wait until the following messages appear:
Uploading default field mappings to CollectionUri.
You have successfully uploaded field mappings to collection CollectionUri.
To upload the mappings from a file
At the command prompt, type the following command, and then choose ENTER.
TfsAdmin ProjectServer /UploadFieldMappings /collection:tpcUrl /filePath:MappingFile /force
Replace tpcUrl with the URL of the team project collection, and replace MappingFile with the path and name of your custom mapping file. Specify /force if you are updating the existing mappings.
Wait until the following messages appear:
Uploading MappingFile to Team Project Collection tpcUrl.
You have successfully uploaded field mapping file MappingFile to Team Project Collection tpcUrl.
Customize the Project Server tab
When you associate an enterprise project plan with a team project, the Project Server tab is added to the work item form, as the following illustration shows. The tab is added to only those types of work items that you specify to participate in data synchronization. You customize this tab by setting the
displayTfsMirror attributes to
true for those fields that you want to have appear on the form.
Project Server tab
The field mappings that are defined for the team project collection determine the fields that appear on the Project Server tab. After this tab has been added to a work item type for a team project, you can update it by modifying the field mappings for the collection. If you manually customize the work item form by adding fields to the Project Server tab or changing its location on the form, the tab may not get automatically updated with future changes that you make to the field mappings. If this condition occurs, you can modify the tab manually. For more information, see Added elements to WIT definitions.
For more information about each default field that appears on the Project Server tab, see Project Server fields that support data synchronization.