(Transfer) MSN Spaces Development Interface VB.NET Version

xiaoxiao2021-03-31  209

I haven't written blog for a long time, and the translation work has not continued to finish the software designer. I hope that there will be time to continue that work, I'm too busy recently. At the end, there is a bunch of things to see, the design Week also has a blueprint, the oil tank is really a tossing me ~ If some netizens want to continue translation, Please contact me. I can do school to work. Thank you, I was in the MSDN community a few days ago, because I also used the trivial matter with MSN space, and MSN often has some problems, so I found out below, I wanted to write a client, then Local editing storage, automatically upload. Ha ha ~ wait for the test, I have to try it, I can contact me if I want to develop together. Ha ha ~ first turn the bottom of Dongdong ~ Interested friends can see, the code is very clear, it is easy to understand ~

Metaweblogapi and MSN Spaces MSN Spaces Metaweblog API, Version 1.00

Metaweblogapi VisualBasic .NET Code Sample Imports System

Imports cookcomputing.xmlrpc

Imports system.net

Namespace Metaweblogapi

'/

'/ This struct represents information about a user's blog.

'/

_

Structure Userblog

Public URL AS STRING

Public BlogID as string

Public blogname as string

End structure

'/

'/ This struct represents information about a user.

'/

_

Structure UserInfo

Public URL AS STRING

Public BlogID as string

Public blogname as string

Public firstname as string

Public Lastname As String

Public email as string

Public Nickname As String

End structure

'/

'/ This struct represents the information about a category That Could Be returned by the

'/ getcategories () method.

'/

_

Structure Category

Public Description As String

Public Title As String

End structure

'/

'/ This struct represents the information about a post what could be returned by the

'/ editpost (), getRecentPosts () and getpost () Methods.

'/

_

Structure Post

Public Datecreated as datetime

Public Description As String

Public Title As String

Public Postid As String

Public categories () AS STRING

End structure

'/

'/ This class can be used to programatically intect with a weblog on

'/ MSN Spaces Using The MetaWeblog API.

'/

_

Class msnspacesmetaweblog

Inherits XMLRPCCCLIENTPROTOCOL

'/

'/ Returns the MOST DRAFT AND NON-DRAFT Blog Posts Sorted in Descending Order by Publish Date.

'/

'/ this kind of be the string myblog, Which indeicates That the post is being created in the user's blog.

'/ The name of the user's space.

'/ The user's secret word.

'/ The number of posts to return. The maximum value is 20.

'/

_

Public property getRecentPosts (() AS POST ()

End Property

)

END FUNCTION

'/

'/ Posts a new entry to a blog.

'/

'/ this kind of be the string myblog, Which indeicates That the post is being created in the user's blog.

'/ The name of the user's space.

'/ The user's secret word. ' / a struct representing the content to update.

'/ if false, this is a draft post.

'/ The postid of the newly-create POST.

_

Public property newpost (() AS STRING

End Property

)

END FUNCTION

'/

'/ Edits an existing entry on a blog.

'/

'/ The id of the post to update.

'/ The name of the user's space.

'/ The user's secret word.

'/ a struct representing the content to update.

'/ if false, this is a draft post.

'/ always returns true.

_ _

Public property editpost (() AS Boolean

End Property

)

END FUNCTION

'/

'/ Deletes a post from the blog.

'/

'/ this value is ignored.

'/ The id of the post to update.

'/ The name of the user's space.

'/ The user's secret word.

'/ a struct representing the content to update. ' / this value is ignored.

'/ always returns true.

_

Public property deletepost (() as boolean

End Property

)

END FUNCTION

'/

..

'/

'/ this value is ignored.

'/ The id of the post to update.

'/ The name of the user's space.

'/ an Array of Structs That Repesents Each of the user's block.

'/ The Array Will Contain A Maximum of One Struct, Since A User Can Only Blog.

_

Public property getUsersblogs (() as userblog ()

End Property

)

END FUNCTION

'/

'/ Returns basic user info (name, e-mail, userid, and so on).

'/

'/ this value is ignored.

'/ The id of the post to update.

'/ The name of the user's space.

'/ a struct containing profile information about the user.

'/ EACH STRUCT WILL Contain The Following Fields: Nickname, Userid, URL, E-Mail,

'/ lastname, and firstname. _ _

Public property getuserinfo (() AS UserInfo

End Property

)

END FUNCTION

'/

'/ Returns a specific entry from a blog.

'/

'/ The id of the post to update.

'/ The name of the user's space.

'/ The user's secret word.

'/ always returns true.

_ _

Public property getpost (() AS POST

End Property

)

END FUNCTION

'/

'/ Returns the list of categories That Have Been Used In The Blog.

'/

'/ this kind of be the string myblog, Which indeicates That the post is being created in the user's blog.

'/ The name of the user's space.

'/ The user's secret word.

'/ an Array of Structs That Contains One Struct for Each Category.

'/ Each Category Struct Will Contain A Description Field That Contains The name of the category.

_

Public property getcategories (() as category ()

End Property

)

END FUNCTION

'/

'/ The main entry point for the application.

'/

_

Shared Sub Main (Byval Args () AS STRING

DIM MW as msnspacesmetaweblog = new msnspacesmetaweblog () DIM Username as string = "! Space3 * pqc3 * o00y0!"

Dim Password As String = "MysecretWord"

Mw.credentials = new networkcredential (username, password)

Try

'Space3PQC3YUO00Y0

DIM POST AS Post = New Post ()

Post.categories = new string ()

{

Test Posts

}

Post.title = "Tets 3"

Post.description = "this is my 3rd test POST"

Post.datecreated = datetime.now

DIM ID as string = mw.newpost ("Myblog", UserName, Password, Post, True

Post.title = "TEST 3 (Test 3"

MW.EDITPOST (ID, Username, Password, Post, True)

Post = MW.GETPOST (ID, Username, Password)

Console.writeline ("Just Edited The Post with Title '{0}' AT '{1}'", post.title, post.datecreated

'Display List of categories Used on the blog * /

Dim categories () as category = mw.getcategories ("Myblog", UserName, Password)

DIM C As Category

For Each C in Categories

Console.writeline ("Category: {0}", C.Description)

NEXT

'Display Title of the Ten Most Recent POSTS. * /

DIM Posts () as post = mw.getRecentPosts ("Myblog", Username, Password, 10)

DIM P AS POST

For Each P in Posts

Console.writeline ("Post Title: {0}", P.TITLE)

NEXT

MW.DeletePost (String.empty, ID, Username, Password, True)

Console.writeline ("The Post Entitled '{0}' Has Been Deleded", Post.Title)

'GET INFO ON User's Blogs * /

DIM blogs () as userblog = mw.getusersblogs (string.empty, username, password)

DIM B AS Userblog

For Each B in Blogsconsole.writeline ("The Url of '{0}' IS {1}", B.Blogname, B.URL)

NEXT

'Get info on the user * /

DIM User as userinfo = mw.getuserinfo (String.empty, Username, Password)

Console.Writeline ("{0} {1} is the Owner of the space whose url is {3}", user.firstname, user.lastname, user.email, user.URL)

Catch XRFE as XMLRPCFAULTEXCEPTION

Console.writeline ("Error: {0}", XRFE.Faultstring)

END TRY

Console.readline ()

End Sub

END CLASS

End Namespace

转载请注明原文地址:https://www.9cbs.com/read-130848.html

New Post(0)