3

我正在使用此代码在博客上创建新帖子,但我正在搜索如何在我们的帖子中附加和上传图片。

Imports Google.GData.Blogger
Imports Google.GData.Client        

    Dim service As New BloggerService("<my apps name>")
    service.Credentials = New GDataCredentials("<email>", "<apps password>")
    Dim newPost As AtomEntry = New AtomEntry()
    newPost.Title.Text = "Test Title"
    newPost.Content = New AtomContent()
    newPost.Content.Content = "<h2>Test HTML Content</h2>"
    newPost.Content.Type = "html"
    Dim response As AtomEntry = Nothing

    Dim blogFeedUri As Uri = New Uri("http://www.blogger.com/feeds/" + "<blog ID here>" + "/posts/default")
    response = service.Insert(blogFeedUri, newPost)
4

1 回答 1

4

更新

PicasaWeb API 已停产并被 Google 照片库取代。从这里开始。如果您要从 PicasaWeb API 迁移,请查看以下迁移指南

原始答案

没有直接的方法。在 Blogger 上上传的图片首先会上传到 Picasaweb。因此,您需要使用 picasa 以及 Blogger API。

您可以尝试以下步骤:

  1. 创建一个 UI 以从您的系统中选择图像。
  2. 使用 Google Picasa API 上传图片
  3. 获取上传图片的链接并将其添加到您的 Blogger 的 HTML 代码中。
于 2013-10-14T07:23:00.727 回答