Sinse Google 17日停止API v2,我的数据库同步到Google日历的应用程序停止工作。Google Calander API v3
现在我想迁移到v3,然而它变成了很多努力和缺乏vb.net代码的例子。但我设法得到了一些,但它不工作,我有一些关于它的问题。
首先,Google网站上的新示例说明了那里使用.JSON文件。我如何将这个添加到项目中?
第二,这是从谷歌vb.net示例代码,但它不工作:
Imports System.IO
Imports System.Threading
Imports Google.Apis.Auth.OAuth2
Imports Google.Apis.Calendar.v3
Imports Google.Apis.Services
Imports Google.Apis.Util.Store
Public Class Form1
Private Shared Sub Main(args As String())
Dim credential As UserCredential
' This example uses the client_secrets.json file for authorization.
' This file can be downloaded from the Google Developers Console
' project.
Using stream = New FileStream("client_secrets.json", FileMode.Open, FileAccess.Read)
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, New() {CalendarService.Scope.Calendar}, "user", CancellationToken.None, New FileDataStore("Calendar.Auth.Store")).Result
End Using
' Create the service.
Dim service = New CalendarService(New BaseClientService.Initializer() With {Key.HttpClientInitializer = credential, Key.ApplicationName = "Calendar API Sample" })
End Sub
End Class
的编译器说,有两种错误的关键。没有regornized优先和新()不vailig。
我希望有人能帮助我走出这一点,或在vb.net
工作示例V3期待读你的答复
感谢您的回复。我阅读了有关迁移的文档以及calander服务,但是,问题是我找不到任何信息如何应用正确的语法。也许我错过了一些东西,但我找不到任何使用正确语法的例子。所以也许有人可以帮我解决这个问题? – Triple 2014-12-02 10:17:33