Hi,
I'm having a problem with posting to a selected category on WP. The posting works fine with this code , which i found on the net, the problem is that it posts only to the default category, it wont post on other categories even when i select the blog id.... any ideas?
Code:
Public Structure category
Public categoryId As Object
Public parentId As Object
Public description As Object
Public categoryName As Object
Public htmlUrl As Object
Public rssUrl As Object
End Structure
<XmlRpcUrl("http://mysite.org/xmlrpc.php")> _
Public Interface IWP
Inherits IXmlRpcProxy
<XmlRpcMethod("wp.getCategories")> _
Function getCategories(ByVal args() As String) As category()
End Interface
Public Structure blogInfo
Public title As String
Public description As String
End Structure
Public Interface IgetCatList
<CookComputing.XmlRpc.XmlRpcMethod("metaWeblog.newPost")> _
Function NewPage(ByVal blogId As Integer, ByVal strUserName As String, ByVal strPassword As String, ByVal content As blogInfo, ByVal publish As Integer) As String
End Interface
Button code
Code:
Dim newBlogPost As blogInfo = Nothing
newBlogPost.title = "Test"
newBlogPost.description = "Test"
Dim categories = CType(XmlRpcProxyGen.Create(GetType(IgetCatList)), IgetCatList)
Dim clientProtocol = CType(categories, XmlRpcClientProtocol)
clientProtocol.Url = WPsite & "/xmlrpc.php"
Dim result As String = Nothing
result = ""
Try
result = categories.NewPage(2, WPuser, WPpass, newBlogPost, 1)
'MessageBox.Show("Posted to Blog successfullly! Post ID : " & result)
' ListView1.Items(0).SubItems(1).Text = "Posted to WP..."
Catch ex As Exception
''ListView1.Items(0).SubItems(1).Text = "Error posting to WP..."
' MessageBox.Show(ex.Message)
End Try
references :
Code:
http://stackoverflow.com/questions/3519228/using-vb-net-application-to-post-on-wordpress-blog
http://www.dotnetcurry.com/ShowArticle.aspx?ID=419