I wrote this wrapper around the Google Reader API recently that might be useful if you’re trying to do the same thing – especially if you’re doing it from Silverlight where you need to work asynchronously and across a reduced .NET framework stack. Quite a bit of my early investigations were based on the great effort put in by Martin Doms – his stuff still stands apart from the security stuff which Google have since changed.
The component I created is pretty easy to use.
Start by connecting to Google Reader using your normal email and password.
public class TestReader
{
private Reader GoogleReader { get; set; }
public TestReader()
{
GoogleReader.SignIn(email, password, (result) =>
{
if (result.Result)
{
// Do something...
}
});
}
}
Once connected you can start calling the other methods – each of which accepts a callback arguement to receive the (strongly typed) results on. For example, to retrieve 20 unread items,
GoogleReader.GetUnreadItems(20, (result) =>
{
foreach (Item item in result.Items)
{
// Do something with each item
}
}
);
You can also edit individual items by passing in the id and streamId of the item (accessed from the results of a call to one of the list methods).
GoogleReader.StarItem(id, streamId, (result) =>
{
if (result.Result)
{
// Do something - it worked!
}
});
There are lots of other commands I’ve implemented (and more that could be done) but this should give you a good starting place.
I’ve also added a simple test application that lets you see what’s going on.
I’ve only tested this in Silverlight 4 and VS 2010 but it should easily adapt to any future Silverlight releases or non-Silverlight solutions.
Get the source code here