【发布时间】:2014-12-21 04:01:56
【问题描述】:
我正在使用以下代码连接到 Google Calendar 3。
Dim datafolder As String = Server.MapPath("App_Data/CalendarService.api.auth.store")
Dim scopes As IList(Of String) = New List(Of String)()
Dim UserId As String = "101935195xxxxxx-jm6o24ifgbixxxxxxxxxxxx@developer.gserviceaccount.com".Trim()
scopes.Add("https://www.googleapis.com/auth/calendar")
Dim myclientsecret As New ClientSecrets() With { _
.ClientId = myClientID, _ ' It is saved in the web config
.ClientSecret = ClientSecret _ ' It is saved in the web config
}
Dim flow As GoogleAuthorizationCodeFlow
Try
flow = New GoogleAuthorizationCodeFlow(New GoogleAuthorizationCodeFlow.Initializer() With { _
.DataStore = New FileDataStore(datafolder), _
.ClientSecrets = myclientsecret, _
.Scopes = scopes
})
Catch ex As Exception
lblerr.Text = ex.ToString
End Try
它抛出:
System.TypeInitializationException:“Google.Apis.Http.ConfigurableMessageHandler”的类型初始化程序引发了异常。
System.IO.FileLoadException:无法加载文件或程序集“系统,版本=2.0.5.0,文化=中性,PublicKeyToken=7cec85d7bea7798e,可重定位=是”或其依赖项之一。给定的程序集名称或代码库无效。 (HRESULT 异常:0x80131047)
我在这个编码中做错了什么?为什么我没有通过身份验证?
【问题讨论】:
标签: vb.net google-api google-calendar-api