【问题标题】:Errors running Google API calendar example for vb.net为 vb.net 运行 Google API 日历示例时出错
【发布时间】:2013-05-13 16:47:10
【问题描述】:

当我尝试在 VBExpress 2010 中运行 this example 时,我收到以下智能感知错误。

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

这一行生成:

错误 7 重载解析失败,因为无法访问 'GetStringValue' 对这些参数最为具体: 在“Google.Apis.Util.Utilities”中定义的扩展方法“Public Function GetStringValue() As String”:不是最具体的。 'Google.Apis.Util.Utilities' 中定义的扩展方法'Public Function GetStringValue() As String':不是最具体的。

另外,这两行都会产生一个“未定义”的错误。

Dim credentials As FullClientCredentials = promptingClientCredentials.EnsureFullClientCredentials()
Dim initializer As New BaseClientService.Initializer()

错误 9 类型“BaseClientService.Initializer”未定义。
错误 8 类型“FullClientCredentials”未定义。

最后,这一行:

Dim state As IAuthorizationState = AuthorizationMgr.GetCachedRefreshToken(STORAGE, KEY)

产生错误:

错误 15 'AuthorizationMgr' 未声明。可能无法访问 由于它的保护级别。

关于第一个错误,google.apis.silverlight.google.apis.util.utilitiesgoogle.apis.google.apis.util.utilities 都有一个GetStringValue(system.enum) as String 方法。

对这些错误有什么想法吗?

更新:排除 Silverlight dll 似乎可以解决第一个错误(“不是最具体的”)

【问题讨论】:

  • 更新帖子时,您应该只添加对 Google.Apis 程序集的引用。您使用哪个版本的库? 1.3.0-测试版?您是否添加了“导入 Google.Apis.Util”以使用“GetStringValue”扩展方法?
  • 是的,使用 1.3.0-beta。我在示例中包含了“导入 Google.Apis.Util”和所有其他导入。如上所述,“不是最具体的”错误已解决。但是,其他 2 个错误 - “BaseClientService.Initializer”和“FullClientCredentials”未定义 - - 仍然存在。
  • 手动添加 Google.Api.Samples.Helper.dll(似乎不是 1.3.0-beta 的 zip 下载的一部分)后,错误现在降至 2:“Dim credentials As FullClientCredentials = PromptingClientCredentials.EnsureFullClientCredentials()”仍会生成错误 1 ​​类型“FullClientCredentials”未定义。并且“state = AuthorizationMgr.RequestNativeAuthorization(client, scopes.ToArray())”现在生成错误 3 'RequestNativeAuthorization' is not a member of 'Google.Apis.Samples.Helper.AuthorizationMgr'。
  • 这很奇怪。您能否检查一下 - 我认为出现此问题是因为您使用的是 VS 2010 Express。我有一个适用于我的 VB.NET 示例(尚未提交到示例存储库),我只想检查它是否也适用于您。请问可以下载吗?它可以在以下链接中找到 - codereview.appspot.com/7007048。请记住从示例存储库(DotNetOpenAuth、Google.Apis、Google.Apis.Authentication.OAuth2、Google.Apis.Calendar.v3 和 Newtonsoft.Json.Net35)中添加正确的引用。不便之处敬请见谅。
  • 我认为这与我使用的示例相同。无论如何,我(重新)下载它并得到相同的 2 个智能感知错误:在 Dim 凭据 As FullClientCredentials = PromptingClientCredentials.EnsureFullClientCredentials() 处,FullClientCredentials 被标记为未定义,并询问我是否要将其更改为 Net.ICredentials;在 state = AuthorizationMgr.RequestNativeAuthorization(client, scopes.ToArray()),我被告知 RequestNativeAuthorization 不是 google.apis.samples.helper.authorizationmagr 的成员(requestauthorization(system.uri) 是最接近的方法)thks 寻求帮助跨度>

标签: vb.net oauth google-api-dotnet-client


【解决方案1】:

我们刚刚发布了一个使用 VB.NET 和 OAuth2 的新示例。 它适用于 VS Professional 2012。看看 - http://samples.google-api-dotnet-client.googlecode.com/hg/Calendar.VB.ConsoleApp/README.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-02
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多