Tag Archives: OData

TFS/ALM

Creating and updating Work Items via OData for TFS

This entry is part of a series, OData Service for TFS»

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 ArgumentNullException on 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.

read more »

TFS/ALM Windows Phone 7/8

Consuming OData for TFS using C# from Windows Phone 7 application

This entry is part of a series, OData Service for TFS»

*UPDATED 26.3.2012 ADDED CODE FOR ODATA SERVICE AUTHORIZATION AND FIXED ExecuteAsync wrapper*

In the earlier post we saw how to consume the OData service from console application. The same code applies for any desktop application, whether it is Windows Forms or WPF application. Since there is no support for developing WP7 applications in the Visual Studio 11 Beta, the code is written in the Visual Studio 2010 Express for Windows Phone.

Add the reference to the OData service using the instructions from the last post. read more »

TFS/ALM

Consuming OData for TFS using C#

This entry is part of a series, OData Service for TFS»

*UPDATED 26.3.2012 FIXED ExecuteAsync wrapper*

In the previous post we saw how to install and configure OData Service for TFS 11. Before we proceed with extending the service, let’s see how to consume it. For this example, we are going to build from scratch a simple console program using C#. Then we are going to fetch some data. We will be doing it in Visual Studio 11 in .NET 4.5.

Create a new Console Application project with in Visual C# templates and make sure that you target .NET Framework 4.5. Add new service reference and type in full path to OData Service, in my case the address is

http://localhost/ODataTFS.Web/DefaultCollection.

Note that the team project collection is included in the uri. Change default name for namespace to TFSData and click OK. Just before closing, the dialog should look similar to the image below. If you do not see IterationPaths in your dialog, do not worry, we will come to that part in our next posts. read more »

TFS/ALM

Installing and configuring OData Service for TFS 11

This entry is part of a series, OData Service for TFS»

TFS does not expose clean REST like interface for easy application consumption. This is required for developing rich applications on wide range of devices such as tablets or smartphones. You can build client applications by using Object Model that comes installed with Team Explorer. It gives you great power and flexibility, but limits you to depend on the TE installation.

Microsoft has recently developed an OData Service for Team Foundation Server (you can grab it here) and Brian Keller wrote excellent introductory post. At the moment, the OData Service was built for TFS 10, but I will show that you can easily convert it to work for TFS 11. read more »