Asp.net 谷歌日历Api v3.NETMVC-在Razor视图中显示
我一辈子都找不到如何在视图中显示日历。我可以进行编码,我非常喜欢使用新API和razor视图在iframe中显示日历的示例 这是谷歌的代码。问题是验证器工厂。。它不存在。如果让类在.dll之外使用,它也会引用不存在的类和参数不正确的方法 我显然没有使用“Main”方法,但是由于authorizationfactory和其他几个缺少的类/方法,无法实现这段代码Asp.net 谷歌日历Api v3.NETMVC-在Razor视图中显示,asp.net,asp.net-mvc-3,razor,google-calendar-api,Asp.net,Asp.net Mvc 3,Razor,Google Calendar Api,我一辈子都找不到如何在视图中显示日历。我可以进行编码,我非常喜欢使用新API和razor视图在iframe中显示日历的示例 这是谷歌的代码。问题是验证器工厂。。它不存在。如果让类在.dll之外使用,它也会引用不存在的类和参数不正确的方法 我显然没有使用“Main”方法,但是由于authorizationfactory和其他几个缺少的类/方法,无法实现这段代码 public static void Main(string[] args) { // Register the a
public static void Main(string[] args)
{
// Register the authenticator. The Client ID and secret have to be copied from the API Access
// tab on the Google APIs Console.
var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description);
provider.ClientIdentifier = "YOUR_CLIENT_ID";
provider.ClientSecret = "YOUR_CLIENT_SECRET";
AuthenticatorFactory.GetInstance().RegisterAuthenticator(
() => new OAuth2Authenticator(provider, GetAuthentication));
// Create the service. This will automatically call the previously registered authenticator.
var service = new CalendarService();
}
private static IAuthorizationState GetAuthentication(NativeApplicationClient arg)
{
// Get the auth URL:
IAuthorizationState state = new AuthorizationState(new[] { CalendarService.Scopes.Calendar.GetStringValue() });
state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
Uri authUri = arg.RequestUserAuthorization(state);
// Request authorization from the user (by opening a browser window):
Process.Start(authUri.ToString());
Console.Write(" Authorization Code: ");
string authCode = Console.ReadLine();
Console.WriteLine();
// Retrieve the access token by using the authorization code:
return arg.ProcessUserAuthorization(authCode, state);
}
我建议永远不要推荐Google针对.NET的Calender API 3,我只是选择了Python。他们的文档在其他方面都是可笑的。在谷歌引用T之后,我试着在他们的LIB中获取课程,并将它们放入一个巨大的文件中。他们个人引用不存在的类,错误地使用方法。等。如果一个人已经让他们的新API v3工作,他们是一个了不起的程序员。就我的观点而言,我发现了一个使用aspx的示例,但是auth都是用汉字编写的,所以基本上就停留在这一点上。我想如果我只是使用他们的代码,我会有一个好的开始,但他们给你的第一个方法是Brokersorry,我肯定我错过了一些非常简单的东西,但我似乎无法让它工作。你以前用过吗?@Chaz3n,你没有回答安迪·埃文斯的问题:你试过什么。@Darin我将代码添加到opI确认中,这是一场噩梦。。。而Google API v3 for MVC的实现甚至没有文档记录。我可以一件一件地找到解决方案(不是那么明显):