Click here to Skip to main content
13,197,200 members (58,448 online)
Click here to Skip to main content
Add your own
alternative version


10 bookmarked
Posted 9 Jan 2010

Google Code Issue Tracker API for .NET

, 9 Jan 2010
Rate this:
Please Sign up or sign in to vote.
The Google Code Issue Tracker client library for .NET.


The Google Code Issue Tracker client library for .NET will allow .NET applications to view/update issues in the Google Code Project Hosting service. Using this library, any .NET client application can do the following things:

  1. Get all the issues from a project.
  2. Submit a new issue to a project.
  3. Get all comments associated with a project.
  4. Create a new comment on an issue.

The code is written in pure C# 3.0, but the library is compliant with .NET 2.0. The project is hosted at Visit there for latest updates.


This project is not affiliated with Google. The Standard GData library doesn't have any .NET API for the Project Hosting service, that's why this project was born.

Using the Code

This library has been built using C# 3.0 using Microsoft .NET framework v2. Any .NET client applications targeting .NET framework v2 or higher can use this library. This library is also Mono v2.x compliant. Applications targeting Mono v2.x or above can use this library without any compatibility issues.

To use the IssueTracker library, you have to have a Google Account. If you don't have it already, you can create one here at

To start with the IssueTracker library, you have create to references for three library files:

  1. GCore.dll
  2. GCodeIssueTracker.dll
  3. System.Serialization.Xml.dll

System.Serialization.Xml is a library which handles the serialization and de-serialization of the ATOM feed XML of the Google service. Please refer to the documentation file for more details about this library. GCore.dll is a core library handling the underlying conversion between objects and XML, and submission and retrieval of data from Google. It exposes some base classes for handling ATOM feeds and the Google service. Please refer to the help file for further details. GCodeIssueTracker.dll is the main library handling the Google Code Issue Tracker service. It uses GCore.dll for the submission and retrieval of issues and comments as well. For further details, please consult the help file of the project.

To use the library, add the following block of using declarations:

using System.Net;
using GCore;
using GCodeIssueTracker;
using GCodeIssueTracker.Query;

Authentication Using ClientLogin Credentials

The GCore library uses the ClientLogin mechanism for the authentication into the Google Code service. Initialize ProjectHostingService with the username and password provided, and subsequent calls will automatically be authenticated.

Use the following code snippet for authentication:

var service = new ProjectHostingService("project-name")
    GUserName = "",
    GPassword = "gmailpassword",
    ProxySettings = new WebProxy("proxy-host-address", port)
                Credentials = new NetworkCredential
                            UserName = "proxy-username",
                            Password = "proxy-password"

For more details on the ProjectHostingService class, consult the help file in the distribution package.

Retrieving all Issues

To get all the issues as a feed, use the following code snippet:

IssuesFeed resultFeed = service.GetAllIssues();
foreach (IssuesEntry item in resultFeed.Entries)
    Console.WriteLine(item.Id + " " + item.Title);

IssuesFeed is class which holds all the issues as a collection of IssuesEntry objects and some other fields. These classes are directly mapped into the XML ATOM feed got from the service. System.Serialization.Xml serializes these class to an ATOM feed which the Google service accepts, and it deserializes the ATOM feeds to these objects.

The GetAllIssues() method of the ProjectHosti<code>ngService class calls the underlying service function as follows:

public IssuesFeed GetAllIssues()
    GUrl = "" + 
           ProjectName + "/issues/full";
    return base.GetAllFeed<IssuesFeed, IssuesEntry>();

GUrl is a property of the GService class which holds the feed URL for the service. The GService class uses generics heavily, but normal users don't have to worry about it, because these complexities are hidden fully in the upper level service class.

Retrieving Issues Using Query Parameters

The Google Code IssueTracker also provides you the facility to retrieve issues satisfying certain parameters like ID, published date, owner, author etc. To query the service, you have to create a IssueQuery object first, then append the query parameters with the value into it, and lastly, call the service function Query to get the results. Here is the example:

var query = new IssueQuery();
query.AppendQuery(QueryParamType.CanAll, "");
query.AppendQuery(QueryParamType.Author, "someauther");
query.AppendQuery(QueryParamType.Id, "104");
query.AppendQuery(QueryParamType.Label, "High");
query.AppendQuery(QueryParamType.MaxResults, "1000");
query.AppendQuery(QueryParamType.Owner, "username");
query.AppendQuery(QueryParamType.QueryString, "blogger");
query.AppendQuery(QueryParamType.Stars, "4");
query.AppendQuery(QueryParamType.Status, "Fixed");
IssuesFeed resultFeed = service.Query(query);
foreach (IssuesEntry item in resultFeed.Entries)
Console.WriteLine("Total feed : " + resultFeed.Entries.Count); 

Some parameters are mutually exclusive to others, like ID can't be there in the query along with max-result. In that case, the first appended parameter will be taken into account and others will not.

Retrieving Comments for an Issue

To get all the comments associated with a particular issue, you have to pass the issue ID into the service method, as follows:

IssueCommentsFeed resultFeed = service.GetAllIssueComments("104");

Creating an Issue

This is the most valuable part of this document. Using this library, you can directly post the issue into the Google Code project from the client applications. If the submission is successful, the service method will return a new IssueEntry object containing additional information like the issue ID, published date etc. A small example is given below:

var newEntry = new IssuesEntry
    Author = new Author { Name = "username" },
    Content = new Content { Type = "text", 
              Description = "Some Issue Descriptions" },
    Owner = new Owner { UserName = "username" },
    Status = "New",
    Title = "Test One",
    Labels = new List<string> { "Priority-Medium" },
    Ccs = new List<Cc> { new Cc { UserName = "username" } }
int id = service.SubmitNewIssue(newEntry, "app-name").Id;

Creating an Issue Comment

Creating a comment is much like creating an IssueEntry. Here is how we can do it:

IssueCommentsEntry entry = new IssueCommentsEntry();
entry.Author = new GCore.Author { Name = "TestCommentName" };
entry.Content = new GCore.Content { Description = "Test Comment" };
entry.Updates = new Updates 
    CcUpdates = new List<string> { "username" }, 
    Labels = new List<string> { "Test Comment Update" }, 
    Status = "New", Summary = "Test Summery", 
    UpdateOwner = "username" 
IssueCommentsEntry newEntry = 
  service.SubmitNewIssueComment(entry, "7", "TestApp");
Console.WriteLine("New Comment's Id : " + newEntry .Id);


As Google Code IssueTracker service does not have a deletion API, the web-interface has to be used to perform the operation.

Points of Interest

The whole code base (except Google Account Authorization) has been written from scratch using different approaches from the official Google Data library. This approach is very slick and highly extensible. The GCore library is written in such a way that any Google service which depends on ATOM feeds can be written using it. The main formula behind this extensibility is Generics. All the methods of the base service class, i.e., GService, are generic. You can create your own customized child ATOM feed/entry class and use it in your own child Google service class.

The System.Serialization.Xml library is also a very useful one. It can serialize any class to XML and also deserialize from it. This library is the one which converts the ATOM XML into a feed class. This library is a general purpose library, not constrained to this project only. Under the hood, it also uses generics for serialization. Maybe, I'll write another article about this little, but useful, library.


  • 9-Jan-2010: Initial post.


This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


About the Author

Anindya Chatterjee
Web Developer Tata Consultancy Services
India India
I am working as a J2EE/Weblogic web developer at Tata Consultancy Services, India.

You may also be interested in...


Comments and Discussions

GeneralApllication error when fetching issues Pin
drwbns9-Apr-11 13:43
memberdrwbns9-Apr-11 13:43 
GeneralRe: Apllication error when fetching issues Pin
Anindya Chatterjee9-Apr-11 19:30
memberAnindya Chatterjee9-Apr-11 19:30 
GeneralRe: Apllication error when fetching issues Pin
drwbns10-Apr-11 7:25
memberdrwbns10-Apr-11 7:25 
GeneralRe: Apllication error when fetching issues Pin
drwbns10-Apr-11 7:26
memberdrwbns10-Apr-11 7:26 
GeneralRe: Apllication error when fetching issues Pin
Anindya Chatterjee10-Apr-11 7:31
memberAnindya Chatterjee10-Apr-11 7:31 
GeneralRe: Apllication error when fetching issues Pin
drwbns10-Apr-11 8:18
memberdrwbns10-Apr-11 8:18 
GeneralRe: Apllication error when fetching issues Pin
Anindya Chatterjee10-Apr-11 10:03
memberAnindya Chatterjee10-Apr-11 10:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171020.1 | Last Updated 9 Jan 2010
Article Copyright 2010 by Anindya Chatterjee
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid