0

Google カレンダー API バージョン 3 の承認で行き詰まっています

私が構築しようとしているのは、データベースのコンテンツを Google カレンダーにフィードするアプリケーションです

私はこのアプリケーションを Google Api バージョン 2 で完全に動作させました。ただし、バージョン 3 には使用したい新機能がいくつかあります。

残念ながら、バージョン 3 は下位互換性がありません

これはこれまでの私のコードです:

Imports DotNetOpenAuth.OAuth2

Imports Google.Apis.Authentication.OAuth2
Imports Google.Apis.Authentication.OAuth2.DotNetOpenAuth
Imports Google.Apis.Calendar.v3
Imports Google.Apis.Calendar.v3.Data
Imports Google.Apis.Util

Public Shared Sub Main(args As String())

    Dim provider = New NativeApplicationClient(GoogleAuthenticationServer.Description)
    provider.ClientIdentifier = "<client id>"
    provider.ClientSecret = "<client secret>"
    Dim auth = New OAuth2Authenticator(Of NativeApplicationClient)(provider, AddressOf GetAuthorization)

    Dim service = New CalendarService(auth)

End Sub

Private Shared Function GetAuthorization(arg As NativeApplicationClient) As IAuthorizationState

    Dim scopes As New System.Collections.Generic.List(Of String)

    scopes.Add(CalendarService.Scopes.Calendar.GetStringValue())

    Dim state As IAuthorizationState = New AuthorizationState(scopes)
    state.Callback = New Uri(NativeApplicationClient.OutOfBandCallbackUrl)
    Dim authUri As Uri = arg.RequestUserAuthorization(state)

    Process.Start(authUri.ToString())

    Return arg.ProcessUserAuthorization(state)

End Function

エラーが発生します。Error1'IAuthorizationState' は名前空間 'DotNetOpenAuth.OAuth2' にあいまいです。

何が間違っているのかわかりません(Google APIマニュアルのすべてのステップに従い、DLLも必要です)

うまくいけば、誰かが私を助けることができます。

よろしくお願いいたします。:)

4

1 に答える 1

0

問題を修正しました。NuGet 経由で DLL をインポートしました。インストールされているようでDotNetOpenAuth.OAuth2DotNetOpenAuth.OAuth2.client

しかし、私は Google カレンダー Api v3 を動作させることができなかったので、Api v2 でアプリを作成しました。魅力的に動作します! :)

それでも、OAuth2 を使用した v3 が VB.Net で正しく機能しないというのは Google の奇妙さを発見しました

于 2013-09-12T07:14:44.410 に答える