Código de ejemplo, agrega un post asignándole dos etiquetas:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Google.GData.Client;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] labels = {"label1", "label2"}; //labels que le quiero poner al post
AddPost("titulo1", "body html", labels); //titulo, cuerpo html y array de labels
}
public static bool AddPost(string title, string bodyHTML, string[] labels)
{
Service service = new Service("blogger", "");
service.Credentials = new GDataCredentials("", "");
AtomEntry newPost = new AtomEntry();
newPost.Title.Text = title;
newPost.Content = new AtomContent();
newPost.Content.Content = bodyHTML;
newPost.Content.Type = "html";
foreach (string label in labels)
{
AtomCategory cat = new AtomCategory();
cat.Scheme = new Uri("http://www.blogger.com/atom/ns#");
cat.Term = label;
newPost.Categories.Add(cat);
}
AtomEntry response = null;
try
{
response = service.Insert(new Uri("http://expressraider.blogspot.com/feeds/posts/default"), newPost);
}
catch (GDataRequestException exception)
{
if (exception.ResponseString == "Blog has exceeded rate limit or otherwise requires word verification for new posts")
{
return false;
}
else
{
throw exception;
}
}
if (response == null)
{
throw new Exception("Error inesperado");
}
return true;
}
}
}