简体   繁体   中英

Programmatically add an event to Google Calendar - Request-URI Too Large

Hi
We're on a project where we've got a Calender and events in it. Users are allowed to add shown events into their Google Calender by simply hitting a button.

I see that it's possible to add an event using URL and it works great since today. There's an event with a little big description (about 1000 characters or more) and it crashes on Google's side when he evaluate the URL because it was truncated as it was too large.

So, I know there's an API than can be use but if my memory's still good, to add an event to the calendar, you must have access to username and password of the user's Google account.

Question
Is there any way to use API with an non-authenticate user or what is the best solution here without asking user's email and password? Because, I can for sure continue with URL, but the max lenght of my description is a bit confusing because my events are written in french. So, an "É"(1 char) is "&ecute;"(7 chars).

Without knowing how your users interact with Google Calendar (individual users or google apps account, console or web app) its difficult to say. The calendar API does allow you to add events without authentication if you make the calendar public and allow everyone to add events.

What you could do is have a service account which has access to said calendar to add events and use that to authenticate to the calendar api. Again without knowing how your users interact with google it's hard to say.

I'm familiar with using the Google Calendar API (in C#) and I'm pretty sure that it just wraps the http post/get request in an object oriented way. This means that you'd still hit your URL length limit even using the API.

It looks like there is a 256 character limit on event descriptions when added via URL: http://www.google.com/support/forum/p/Calendar/thread?tid=4e8d5d012dadc7b9&hl=en

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM