如何使用XML RPC发布新帖子

时间:2015-01-25 16:42:09

标签: c# xml-rpc

我使用WordPressSharp lib link但是在文档中我找不到如何发布新文章。默认情况下,新文章将进入草稿。

    var post = new Post {
    PostType = "post",
    Title = "My Awesome Post",
    Content = "<p>This is the content</p>",
    PublishDateTime = DateTime.Now
};

using (var client = new WordPressClient(new WordPressSiteConfig {
    BaseUrl = "http://mywordpress.com",
    Username = "admin",
    Password = "password",
    BlogId = 1
})) 
{
    var id = Convert.ToInt32(client.NewPost(post));
}

1 个答案:

答案 0 :(得分:0)

添加以下行:

Status = "publish";