我已经尝试了几个小时,但我无法让它工作。我使用以下代码(VB)
Private Async Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim credential As UserCredential = Await GoogleWebAuthorizationBroker.AuthorizeAsync(New ClientSecrets With {.ClientId = "my key", .ClientSecret = "my secret"}, New String() {BooksService.Scope.Books}, "user", CancellationToken.None, New FileDataStore("Books.ListMyLibrary"))
Dim service As New BooksService(New BaseClientService.Initializer With {.HttpClientInitializer = credential, .ApplicationName = "LibraryX"})
'Dim bookselve As Bookshelves = Await service.Mylibrary.Bookshelves.List.ExecuteAsync
Dim mm = service.Volumes.Get("9780330441230")
End Sub
它没有给我关于这本书的信息(骆驼俱乐部,大卫巴尔达奇)
有人可以帮助我吗?
问候,史蒂文
20131106
我做了一些改变:
Private Async Sub Form1_Load(sender As Object, e As EventArgs) 处理 MyBase.Load
Dim credential As UserCredential = Await GoogleWebAuthorizationBroker.AuthorizeAsync(New ClientSecrets With {.ClientId = "my key", .ClientSecret = "my secret"},
New String() {BooksService.Scope.Books}, "user", CancellationToken.None, New FileDataStore("Books.ListMyLibrary"))
Dim service As New BooksService(New BaseClientService.Initializer With {.HttpClientInitializer = credential, .ApplicationName = "LibraryX"})
'Dim bookselve As Bookshelves = Await service.Mylibrary.Bookshelves.List.ExecuteAsync
Try
rslt = Await service.Volumes.Get("9780330441230").ExecuteAsync
Dim y As Integer = 0
Catch gaex As Google.GoogleApiException
ErrorMessageTextBox.Text = gaex.Message
Catch ex As AggregateException
ErrorMessageTextBox.Text = ex.Message
End Try
End Sub
但是请求的结果是:
enter code here
Google.Apis.Requests.RequestError 找不到卷 ID。[404] 错误 [ 消息 [找不到卷 ID。] 位置 [ - ] 原因 [未找到] 域 [全局] ]
知道 VolumeId 必须是什么才能从 Google 获取图书信息吗?