Reputation: 1651
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);
}
Upvotes: 2
Views: 1799
Reputation: 1651
I would recommend never recommend Google's Calender API 3 for .NET, I just went with Python. Their Documentation is laughable for everything else.
Upvotes: 2