开发者

Fetch a specific Google Calendar event

开发者 https://www.devze.com 2023-03-16 16:32 出处:网络
Is there a way to get a single event using the Google Calendar .NET API or do I have to fetch all events and loop through them?

Is there a way to get a single event using the Google Calendar .NET API or do I have to fetch all events and loop through them?

I would think there was a way using the "ei开发者_如何学Pythond".


You can retrieve a single event by adding the EventId to the query url, as in the following code:

CalendarService service = new CalendarService("test");
service.setUserCredentials(username, password);
EventQuery query = new EventQuery("https://www.google.com/calendar/feeds/default/private/full/s5uhaebith4jqn864j11ljkckg");
EventFeed feed = service.Query(query);

The returned EventFeed will only contain the single event whose eventId is "s5uhaebith4jqn864j11ljkckg".


You should be able to use the GetEntry method on the service, passing in the URI associated with the event. I haven't personally used the .NET API to talk to Google Calendar though.

(Please note that although I work for Google, I post on my own behalf - don't take this as an "official Google post" :)


you cannot pick an Event just by querying using above. The one shown above will work only for default calendars. If you have secondary calendars, the same query will work, but need to replace the emailId section in the feed URL to the Id of the secondary calendar you want to retrieve.

Ideally, if you just know the EventId and dont know under which list of calendars it belongs to, you have to do a search on all calendars you have, by replacing the calendarId in the above URL until you get your exact match.

This is how it works for me. If there are any other workaround, i request people to post replies please.

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号