// I assume this is my main feed. It works for posting Uri uri = new Uri("http://beta.blogger.com/feeds/<blogid>/posts/full");
// establish service Google.GData.Client.Service service = new Service("blogger", "bloggerApplication"); service.Credentials = new NetworkCredential("<login>", "<password>");
// build query to fetch last post FeedQuery query = new FeedQuery(); query.Uri = uri; query.NumberToRetrieve = 1;
// execute query and get results AtomFeed feed = service.Query(query);
if (feed.Entries.Count > 0) { // here is the post where I wish to add my comment AtomEntry post = feed.Entries[0];
// create comment. I don't know if this is correct AtomEntry comment = new AtomEntry(); comment.Title.Text = "Test comment"; comment.Content.Content = "Test comment"; comment.Updated = DateTime.Now; comment.Published = DateTime.Now; AtomPerson person = new AtomPerson(); person.Name = "John Doe"; comment.Authors.Add(person);
// there are 3 links in the post.Links property but they all fail // none of them indicate they are for comments // service.Insert(new Uri("http://<blogname>.blogspot.com/2006/11/<posttitle>.html"), comment); // service.Insert(new Uri("http://www.blogger.com/feeds/<blogid>/posts/full/<postid>"), comment); // service.Insert(new Uri("http://www.blogger.com/feeds/<blogid>/posts/full/<postid>"), comment);
// I tried some alternatives but they all failed also // service.Insert(new Uri("http://beta.blogger.com/feeds/<blogid>/posts/full/<postid>"), comment); // service.Insert(new Uri("http://beta.blogger.com/feeds/<blogid>/posts/full/<postid>/comments/full"), comment); // service.Insert(new Uri("http://www.blogger.com/feeds/<blogid>/posts/full/<postid>/comments/full"), comment); // service.Insert(new Uri("http://<blogname>.blogspot.com/feeds/<postid>/comments/default"), comment);
I tried this and it does work. However, the Name and URL of posted comments was not the ones set by 'author', but the user used for login. As a result, the author of every comment would be the blog's host himself...
Well, this method could be fairly useful, especially for the situation like me. I and most of my visitors cannot access beta.blogger.com directly from the Internet connection we're using. By this way I can deploy a servlet on my server to submit comments as a proxy.
Although it's not officially supported, it would be great if it could work correctly, as it can already help me a lot.
On 11/17/06, Gregory <gregorys...@gmail.com> wrote:
> I tried this and it does work. However, the Name and URL of posted > comments was not the ones set by 'author', but the user used for login. > As a result, the author of every comment would be the blog's host > himself...
> Well, this method could be fairly useful, especially for the situation > like me. I and most of my visitors cannot access beta.blogger.com > directly from the Internet connection we're using. By this way I can > deploy a servlet on my server to submit comments as a proxy.
> Although it's not officially supported, it would be great if it could > work correctly, as it can already help me a lot.
Thanks for your feedback. This is something we will consider when/if we officially support posting to the comments feed.
I am looking for a way to do exactly this as well. I am attempting to migrate an existing blog of mine (including comments) to a blogger blog. I am currently able to get my posts to migrate over, but I have not been successfully able to post a comment through code yet.
I just found out about this GData .NET API...I had hacked something together using the assemblies from Windows Live Writer :)