我在使用VB.net Express 2012連接到我的Google Drive時遇到問題。 它支持它嗎?Google Drive with VBnet Express
Imports Google.Apis.Auth.OAuth2
Imports Google.Apis.Drive.v2
Imports Google.Apis.Drive.v2.Data
Imports Google.Apis.Services
Imports Google.Apis.Util.Store
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Text
Imports System.Threading
Imports System.Threading.Tasks
Namespace DriveQuickstart
Class Program
Shared Scopes As String() = {DriveService.Scope.DriveReadonly}
Shared ApplicationName As String = "Drive API .NET Quickstart"
Private Shared Sub Main(args As String())
Dim credential As UserCredential
Using stream = New FileStream("client_secret.json", FileMode.Open, FileAccess.Read)
Dim credPath As String = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal)
credPath = Path.Combine(credPath, ".credentials/drive-dotnet-quickstart")
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, Scopes, "user", CancellationToken.None, New FileDataStore(credPath, True)).Result
Console.WriteLine(Convert.ToString("Credential file saved to: ") & credPath)
End Using
' Create Drive API service.
Dim service = New DriveService(New BaseClientService.Initializer() With { _
Key .HttpClientInitializer = credential, _
Key .ApplicationName = ApplicationName _
})
' Define parameters of request.
Dim listRequest As FilesResource.ListRequest = service.Files.List()
listRequest.MaxResults = 10
' List files.
Dim files As IList(Of Google.Apis.Drive.v2.Data.File) = listRequest.Execute().Items
Console.WriteLine("Files:")
If files IsNot Nothing AndAlso files.Count > 0 Then
For Each file As var In files
Console.WriteLine("{0} ({1})", file.Title, file.Id)
Next
Else
Console.WriteLine("No files found.")
End If
Console.Read()
End Sub
End Class
End Namespace
我跑的NuGet中失敗的控制檯上,所以我不得不把DLL的手動複製到項目並添加他們作爲參考,其顯示爲Imports google.*
不給錯誤了工作,但我得到代碼中的錯誤。
任何幫助嗎?
更新
我認爲這個問題可能是我使用vbnet表示2012 作爲對https://developers.google.com/drive/web/quickstart/dotnet它說: 先決條件
要運行這個快速入門,你將需要:
Visual Studio 2013或更高版本。
有什麼解決辦法嗎?
UPDATE2
我不再需要這個代碼,我會用不同的方法 隨時與別人有同樣的問題
我在VS 2010中使用.NET客戶端庫,這樣是不正確的。我知道的唯一先決條件是它需要.net framework 4.0或4.5。 – DaImTo
哪個塊金包確實導入了? – DaImTo
所有4 dll文件從portable-net40 + sl50 + win + wpa81 + wp80(Google.Apis.Auth.dll,Google.Apis.Core.dll,Google.Apis.dll,Google.Apis.Drive.v2.dll) –