Correct MetaWeblogAPI VisualBasic .NET Code Sample

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SanjeevN

    #1

    Correct MetaWeblogAPI VisualBasic .NET Code Sample

    MSDN has sample code for interacting with the MetaWeblog API

    C# Sample - complete and compiles.
    http://msdn.microsoft.com/library/de...ode_Sample.asp

    VB sample - is incomplete and incorrect.
    http://msdn.microsoft.com/library/de...ode_Sample.asp

    Can someone post the equivalent VB code just for this snippet?

    C#
    /// <summary>
    /// Returns the most recent draft and non-draft blog posts sorted in
    descending order by publish date.
    /// </summary>
    /// <param name="blogid"Th is should be the string MyBlog, which
    indicates that the post is being created in the user's blog. </param>
    /// <param name="username" The name of the user's space. </param>
    /// <param name="password" The user's secret word. </param>
    /// <param name="numberOfP osts"The number of posts to return. The
    maximum value is 20. </param>
    /// <returns></returns>
    [XmlRpcMethod("m etaWeblog.getRe centPosts")]
    public Post[] getRecentPosts(
    string blogid,
    string username,
    string password,
    int numberOfPosts){
    return (Post[]) this.Invoke("ge tRecentPosts", new object[]{ blogid,
    username, password, numberOfPosts}) ;
    }


    The given VB.net code is incorrect

    '/ <summary>
    '/ Returns the most recent draft and non-draft blog posts sorted in
    descending order by publish date.
    '/ </summary>
    '/ <param name="blogid">T his should be the string MyBlog, which
    indicates that the post is being created in the user's blog.</param>
    '/ <param name="username" >The name of the user's space.</param>
    '/ <param name="password" >The user's secret word.</param>
    '/ <param name="numberOfP osts">The number of posts to return. The
    maximum value is 20.</param>
    '/ <returns></returns>

    <XmlRpcMethod(" metaWeblog.getR ecentPosts")_
    Public Property getRecentPosts( () As Post()
    End Property
    )
    End Function

Working...