2013-10-13 40 views
1

我正在使用此代碼在博客上創建新帖子,但我正在搜索如何附加和上傳圖片與我們的帖子。如何用博客文章附加圖片 - Google博客主頁 - C# - VB.Net

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) 

回答

2

有沒有簡單的方法。上傳到Blogger的圖片首先上傳到Picasaweb。因此,您需要使用Picasa以及Blogger API。

您可以嘗試以下步驟:

  1. 創建UI從您的系統中選擇圖像。
  2. 使用Google Picasa API上傳圖片
  3. 獲取上傳圖片的鏈接並將其添加到您的HTML代碼中。