2

I cannot for the life of me find how to display a calendar inside my view. I can do the coding I would just love an example of displaying the calendar inside of an iframe using the new API and and a razor view

This is the code from google. The issue is the AuthenticatorFactory.. it doesn't exist. And if you go get the class to use outside of the .dll it also references classes that don't exist, and methods with improper arguments.

I obviously didn't use a "Main" method, but there was no way to implement this code due to the authorizationfactory and several other missing classes/methods

   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);
  }
5
  • Following the google reference to the T. I've tried taking classes in their libs and putting them in a gigantic file. they personally reference classes that don't exist, use methods incorrectly. etc. If a single person has gotten their new API v3 to work they are an amazing programmer. As far as the view I had found an example using an aspx but the auth was all in Kanji, so pretty much just stuck at this point. I figured if I just used their code that I would be off to a good start, but the first method they give you is broken Commented Jun 20, 2012 at 20:43
  • sorry, I'm sure I'm missing something pitifully simple, but I just can't seem to get this to work Commented Jun 20, 2012 at 20:43
  • Have you gotten this to work before? Commented Jun 20, 2012 at 20:59
  • @Chaz3n, you didn't answer Andy Evans question: what have you tried. Commented Jun 21, 2012 at 6:27
  • @Darin I added the code to the op Commented Jun 21, 2012 at 13:21

1 Answer 1

2

I would recommend never recommend Google's Calender API 3 for .NET, I just went with Python. Their Documentation is laughable for everything else.

Sign up to request clarification or add additional context in comments.

1 Comment

I confirm, it's a nightmare... And implementation of Google API v3 for MVC is not even documented. I could find a solution piece by piece (its not that obvious): stackoverflow.com/questions/27241639/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.