In the last two posts we saw how to consume data via OData Service for TFS. Today we are going to create and update Work Items using the service. Create a new console application project, add a service reference to the OData service and create your context (like in the earlier posts).
Creating Work Items
Work Item is created via the TFSServiceReference.WorkItem.CreateWorkItem method. The method accepts four parameters:
ID– set to 0 since you are creating a new Work Item and you cannot specify an ID. If you use an existing ID on the server, you will get the following error:
TF400276: You have tried to set a value for a field of a work item which is not opened or partial opened. You cannot set a value for a field of a work item which is not opened or partial opened.
If you specify a non-existing ID, you will get an
ArgumentNullExceptionon the service side.revision– set to 0 since newly created Work Item has revision 1. Value is unused.createdDate– Value is unused.changedDate– Value is unused.
- Installing and configuring OData Service for TFS 11
- Consuming OData for TFS using C#
- Consuming OData for TFS using C# from Windows Phone 7 application
- Creating and updating Work Items via OData for TFS
- Installing and configuring OData Service for TFS v2
Back to top