问题
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:
- Create a UI to select image from your system.
- Use Google Picasa API to Upload image
- 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