Sample Code: Create a Work Item in Team Foundation
May 26, 2010Allen Clark

Summary
This post provides a C# code sample demonstrating how to programmatically create a Work Item (specifically a User Story) in Team Foundation Server using the Work Item Tracking Object Model (WITOM). It details the steps involved: connecting to the TFS server, obtaining the WorkItemStore, selecting a team project, getting the desired WorkItemType, instantiating a new WorkItem, setting required fields (Title) and optional fields (Description), and finally saving the WorkItem. It also explains default field values and the necessity of setting the Title field.