将后标签发送到XML-RPC中的wordpress

时间:2012-01-29 08:30:46

标签: c# xml-rpc

我在C#中使用XML-RPC.net 3和joeblog dll。一切都很好,但我不能创建并发送后标签到WordPress。 我可以创建包含类别,标题,摘录,内容,cutomfields的帖子,但是没有成功创建帖子标签。 它是我的代码:

 public void createPost(newPost np)
        {
            loginformobject = new LoginForm();
            string postid;
            icp = (IcreatePost)XmlRpcProxyGen.Create(typeof(IcreatePost));
            clientProtocol = (XmlRpcClientProtocol)icp;
            clientProtocol.Url = url.Text;
            try
            {
                postid = icp.NewPost(1, User.Text, Pass.Text, np, 1);

            }
            catch (Exception ex)
            {
                MessageBox.Show("createPost ERROR ->" + ex.Message);
            }
        }

 private void button1_Click(object sender, EventArgs e)
        {
            customField newCustomField2 = default(customField);

            newCustomField2.key = "Testttttttttttt";

            newCustomField2.value = "testttvalye";



            newPost newBlogPost = default(newPost);
            newBlogPost.title = "Some Title<AliReza Test>";
            newBlogPost.description = "Some description Test Test Test Test<AliReza Test>";
            newBlogPost.custom_fields = new customField[] { newCustomField2 };
            newBlogPost.categories = new string[] { "Test" };
            newBlogPost.mt_excerpt = "Tozihate Kotah";
            newBlogPost.mt_taxonomy = new string[] { "test","test2" };
            createPost(newBlogPost);
        }

如何在C#中使用XML-RPC中的标签发送帖​​子?

是否有用于创建帖子标签的库或代码?

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

修复此问题

 public string[] categories;
    public string title;
    public string description;
    public string mt_excerpt;
    public customField[] custom_fields;
    public string[] mt_keywords;

newBlogPost.mt_keywords = new string []{ "t1","t2"};