Create a Work Item By Using the Client Object Model for Team Foundation
You can create bugs, tasks, and other types of WorkItems by performing the following steps:
Depending on the type of WorkItem that you create, most required Fields have default values. If these values are appropriate, you do not have to set them explicitly. For example, you might create a user story as defined in MSF for Agile software development for Visual Studio ALM. For this type of WorkItem, the State, Reason, and Assigned to Fields are all required but have default values. When a user story is created, its default state is "Active," its default reason is "New," and the default value of the Assigned to field is the current user. However, the title is required and has no default value. Therefore, you must set the title when you create a user story. For more information, see User story (Agile) and An end-to-end view of what you can configure and customize in Visual Studio TFS. The following example creates a user story; sets the title, which is required; and sets the description, which is not required.
To use this example
-
Create a C# ( or VB ) console application.
-
Add references to the following assemblies:
-
Replace the contents of Program.cs ( or Module1.vb ) with this example.
Note |
|---|
You can save more than one WorkItem or WorkItemLink in a single round trip by using the WorkItemStore.BatchSave method. |
Note