Hello everyone, I would like to know if there are any examples of how to use Google.Api.Calender to insert events into Google calendar using an Asp.Net application.
I thank you for your help
Hello everyone, I would like to know if there are any examples of how to use Google.Api.Calender to insert events into Google calendar using an Asp.Net application.
I thank you for your help
Google Calendar has an openly published quick start for .NET.
I am using an application where we log in for form authentication and have multiple users, do you know such an example?
Thanks for helping me with all the questions in the forum.
Our system has a task scheduler, but today we want to integrate with the google calendar of employees, because they thought it was a good idea to use them together, but the system works using the authentication form and from what I saw in api uses oauth
and google account calendar id,
and since this is the first time we will be using Google APIs I am unsure how I can communicate with calendars and how I can log into each other’s Google account
Step 4 : Replace Program.cs with following (Must update your ClientId and ClientSecret)
using Google.Apis.Auth.OAuth2;
using Google.Apis.Calendar.v3;
using Google.Apis.Calendar.v3.Data;
using Google.Apis.Services;
using Google.Apis.Util.Store;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CalendarQuickstart
{
class Program
{
static void Main(string[] args)
{
var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId = "your client id",
ClientSecret = "your client secret",
},
new[] { CalendarService.Scope.Calendar },
"user",
CancellationToken.None).Result;
// Create the service.
var service = new CalendarService(new BaseClientService.Initializer
{
HttpClientInitializer = credential,
ApplicationName = "Calendar API Sample",
});
var myEvent = new Event
{
Summary = "Google Calendar Api Insert Event Sample Code by ABC",
Location = "Islamabad, Punjab, Pakistan",
Start = new EventDateTime()
{
DateTime = new DateTime(2020, 3, 7, 14, 0, 0),
TimeZone = "Asia/Karachi"
},
End = new EventDateTime()
{
DateTime = new DateTime(2020, 3, 7, 15, 0, 0),
TimeZone = "Asia/Karachi"
},
Recurrence = new String[] { "RRULE:FREQ=WEEKLY;BYDAY=MO" },
//If you want to add attendee
//Attendees = new List<EventAttendee>()
//{
// new EventAttendee { Email = "youemail@yahoo.com"}
//},
};
var recurringEvent = service.Events.Insert(myEvent, "primary");
recurringEvent.SendNotifications = true;
recurringEvent.Execute();
Console.Read();
}
}
}
If my solution works for you, please mark it as answer! It will help others.
Get more information: http://codemovement.pk
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
19 Points
89 Posts
Insert events or tasks into Google Calendar
Jan 10, 2020 01:43 PM|ecocash|LINK
Hello everyone, I would like to know if there are any examples of how to use Google.Api.Calender to insert events into Google calendar using an Asp.Net application.
I thank you for your help
All-Star
53091 Points
23659 Posts
Re: Insert events or tasks into Google Calendar
Jan 10, 2020 02:26 PM|mgebhard|LINK
Google Calendar has an openly published quick start for .NET.
https://forums.asp.net/post/set/1146/2163085/6290443
Once you get the quick start working then you can move on and learn the Google Calendar API features by read the reference docs.
https://developers.google.com/calendar/v3/reference
Member
19 Points
89 Posts
Re: Insert events or tasks into Google Calendar
Jan 10, 2020 05:39 PM|ecocash|LINK
Hi mgebhad !
I am using an application where we log in for form authentication and have multiple users, do you know such an example?
Thanks for helping me with all the questions in the forum.
All-Star
53091 Points
23659 Posts
Re: Insert events or tasks into Google Calendar
Jan 10, 2020 05:49 PM|mgebhard|LINK
Member
19 Points
89 Posts
Re: Insert events or tasks into Google Calendar
Jan 10, 2020 06:00 PM|ecocash|LINK
Our system has a task scheduler, but today we want to integrate with the google calendar of employees, because they thought it was a good idea to use them together, but the system works using the authentication form and from what I saw in api uses oauth and google account calendar id,
and since this is the first time we will be using Google APIs I am unsure how I can communicate with calendars and how I can log into each other’s Google account
Contributor
2340 Points
807 Posts
Re: Insert events or tasks into Google Calendar
Jan 10, 2020 06:33 PM|codemovement.pk|LINK
Hi ecocash,
Create a console app and follow the steps.
Step 1 : https://developers.google.com/calendar
Step 2 : Enable the Google Calendar API
Step 3 :
Step 4 : Replace Program.cs with following (Must update your ClientId and ClientSecret)
Get more information: http://codemovement.pk
Thanks,
Member
19 Points
89 Posts
Re: Insert events or tasks into Google Calendar
Jan 10, 2020 07:39 PM|ecocash|LINK
Hi codemovement,
My controller for task e events
Participant
1320 Points
491 Posts
Re: Insert events or tasks into Google Calendar
Jan 13, 2020 08:14 AM|jiadongm|LINK
Hi ecocash,
The insert event has been integrated into this API, you can use it directly
https://developers.google.com/calendar/v3/reference/events/insert
Best Regards,
Jiadong Meng