DCSIMG
How To Show A Work Item From Custom Control Using API In TFS - Eran Ruso
Sign in | Join | Help

How To Show A Work Item From Custom Control Using API In TFS

פורסם בתאריך Aug 05 2009, 07:02 AM על ידי Eran Ruso | ישנם 0 תגובות

Yesterday I have created a Custom Control that one of its features is to open a work item for the user to modify.

Since it took me some time to understand how to do it I have decided to post a reference for how to do it in an easy way.

Here is an example of how to do it:

using Microsoft.TeamFoundation.WorkItemTracking.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Controls;
using Microsoft.TeamFoundation.Client;
using Microsoft.VisualStudio.TeamFoundation.WorkItemTracking;

private void ShowWorkItem(WorkItem wiActivity) 
   
        DocumentService docSrv = (DocumentService)serviceProvider.GetService(typeof(DocumentService));

        IWorkItemDocument bugDocument = docSrv.CreateWorkItem(wiActivity, this) as IWorkItemDocument;

        docSrv.ShowWorkItem(bugDocument);

    }

private IServiceProvider serviceProvider; – is part of the IWorkItemControl interface that is required to create a Custom Control.

Have Fun!!!

רשימת תגובות

אין תגובות

שלח תגובה

(שדה חובה) 
(שדה חובה) 
(אופציונלי)
(שדה חובה) 

Enter the numbers above: