Visual Basic sample code using the Tortuga MetaWeblog ActiveX to create a new blog post with an image that is uploaded from the local filesystem to the blog server.
The Tortuga Beta ActiveX can be downloaded from
MetaWeblog ActiveX
The download contains an ActiveX DLL that needs to be registered using regsvr32.exe. You may then import the "Tortuga ActiveX" into your VB project.
' Use the Blogger 1.0 API to get the Blog ID
Dim b1 As New Blogger1
b1.Login = "myLogin"
b1.Password = "myPassword"
b1.ServiceUrl = "http://www.squarespace.com/do/process/external/PostInterceptor"
b1.GetUsersBlogs
blogId = b1.GetBlogId(0)
' Use MetaWeblog to create a new post
Dim mwlog As New MetaWeblog
mwlog.Login = "myLogin"
mwlog.Password = "myPassword"
mwlog.ServiceUrl = "http://www.squarespace.com/do/process/external/PostInterceptor"
' Upload a GIF file to the server.
localFile = "c:/images/dude.gif"
remoteFile = "coolDude.gif"
imageUrl = mwlog.NewMediaObject(blogId, localFile, remoteFile)
postContent = "This is a new post with an image <img src=""" + imageUrl + """>"
postTitle = "Sample post with image"
Dim postId As String
publish = 1
postId = mwlog.NewPost(blogId, postTitle, postContent, publish)
MsgBox "This ID of the post created = " + postId