How can I find the Event Id of my Google Calendar

2019-02-14 17:04发布

问题:

I created some Google Calendar events and now I would like to do some operations on them programmatically.

Trouble is I don't have their IDs.

When I go into the calendar and click on the event, there is nowhere where I can see the ID.

Does anyone know where I can find it?

回答1:

On The Google Calendar Website

Since he originally asked how to click into the calendar and find the ID of a particular event, and since that's what I needed to know how to do too:

  1. Click the event in your Google Calendar.

  2. It will take you to a page with a URL such as https://calendar.google.com/calendar/render?pli=1#eventpage_6%7Ceid-NGh0Z3BtbTFobWFrNzQ0cjBrYmtkY29kYXIgZXVndTlrYW4xZGRpMXBtaTZzazNpYjWoNmdAZw-1-0-

  3. Look for "eid" in the URL.

  4. Select and copy the string between eid- and the next -. (In my example here, it is NGh0Z3BtbTFobWFrNzQ0cjBrYmtkY29kYXIgZXVndTlrYW4xZGRpMXBtaTZzazNpYjWoNmdAZw.)

  5. Now you need to decode from Base64 format. You could paste that string into a tool such as https://www.base64decode.org/.

  6. The result will be two strings separated by a space. The first string is your Event ID.



回答2:

There is another way to see that Event Id.

  1. Go to the event debugging URL at https://www.google.com/calendar/render?gsessionid=OK&eventdeb=1
  2. Double click to view the affected event.
  3. Select the drop down menu 'More Actions'.
  4. Click on the 'Troubleshooting Info'.
  5. Copy the text that appears and paste it in your reply to support.

Source: http://googleappstroubleshootinghelp.blogspot.com/2012/09/how-to-find-troubleshooting-information.html



回答3:

  • get the cal
  • loop thru all events during the time period in question
function myFunction() {
  var cal = CalendarApp.getCalendarById(id);
  var events = cal.getEvents(startTime, endTime);
  for ( var i in events ) {
    var id = events[i].getId();
  }
}


回答4:

The simple answer is eventId = event.get('id'). You didn't ask about the event object but as a guide to others this is how I created it for my Google Calendar python script:

creds = get_credentials()
http = creds.authorize(httplib2.Http())
calendar_service = discovery.build('calendar', 'v3', http=http)
event = calendar_service.events().insert(calendarId='primary', 
body=event).execute()

then

eventId = event.get('id')


回答5:

There is one other quick and easy approach.

  • Click on the event in your calendar. It doesn't need to be in debug mode.
  • From the URL, copy the string between the last slash and the question mark.
  • Paste this string into a base64 encoder. (https://www.base64decode.org/)
  • You will get the event ID and the email of the calendar owner (you?).
  • (The eventId is the first string of characters.)