How To Attach an Image with Blog post - Google Blogger API - C# - VB.Net

心已入冬 提交于 2019-12-21 21:12:32

问题


I am using this code to create new post on blogger but I was searching that how to attach and upload an image with our post.

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)

回答1:


Update

The PicasaWeb API has been discontinued and replaced with Google Photos library. Get started here. If you are migrating from PicasaWeb API, checkout the following Migration guide.

Original Answer

There is no straightforward way. The images uploaded on Blogger are first uploaded to Picasaweb. So you need to work on picasa as well as Blogger API.

You can try following steps:

  1. Create a UI to select image from your system.
  2. Use Google Picasa API to Upload image
  3. get link of uploaded Image and add it to your HTML code of Blogger.


来源:https://stackoverflow.com/questions/19348829/how-to-attach-an-image-with-blog-post-google-blogger-api-c-sharp-vb-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!