I'm confused about using the Google Calendar API for adding/modifying events in ASP.NET webforms (C#).
I'm not sure if I need oAuth or what. My app is on my own server accessing my own domain and my own calendar. I don't need other users to give me access to their calendar; I only need to access my own via my app.
On on one of my aspx pages, I'd like to send event info to my Google calendar to add (or later modify) the event.
I've checked all kinds of code examples and the Google getting started guides. I'm just not clear on what exactly is needed. I've set up an API key and an oAuth2 client ID. The Google instructions have sent me in circles and it's likely due to my needing clarification on what's need.
Can someone please clear-up my confusion and point me in the right direction?
Summary :
To Call a google clould oauth2 protected resource
From your server to google server
Without user interaction
Accessing your own data
Using C#
Code :
Use service methods to get the data
Private Key and client_email can be generated from this link
Calendar Id can be found on calendar.google.com
You must share your calendar with client_email see the demo
Step by Step demo
Step 01 : open google console
https://console.developers.google.com/projectselector/apis/library/calendar-json.googleapis.com
Step 02 : click select
Step 03: select or create a new project
Step 04: click enable or manage
Step 05: click Credentials
Step 06: Create service account key
Step 07: Enter a service account name the click create
Step 08: click Create without role then keep the downloaded json private key in safe place
Step 09: copy your client_email from
Step 10: open google calendar
Step 11: open your calendar Settings and sharing
Step 12: got to Share with specific people and click add
Step 13:
click send
Step 14: on the same page copy and save the Calendar ID we will need it
Step 15: crate new console application
Step 16: add the private key json file to your project
Step 17: r-click private key json and click Propertis
Step 18: change "Copy to output Direcory to "Copy always"
Step 19: open PM Console and chose your project on Default project D
Step 20: Install Google.Apis Calendar Package
Step 21: replace Program.cs with code
Step 22: replace json File Name with your json file name
Step 23: replace calendarId with your calendarId from step 14
Step 24: run the app
Step 25 : visit you calendar you should see the event in