Can I create a Google calendar for a user in a hosted domain using the admin credentials

Posted by user351013 on Stack Overflow See other posts from Stack Overflow or by user351013
Published on 2010-05-26T14:58:40Z Indexed on 2010/05/26 15:01 UTC
Read the original article Hit count: 176

Filed under:

I use the admin credentials for all of my interactions with the google api and I can retrieve\create\update\delete events from and for all of my hosted domain users. However, when I go to create a calendar for a hosted domain user, the calendar is created in the admins space. In the example below the GoogleUserName does NOT match the GoogleAccount. The postUri would look similar to : http://www.google.com/calendar/feeds/[email protected]/owncalendars/full and the GoogleUserName is [email protected]. The api creates a calendar but it is in the admins space.

CalendarService service = new CalendarService("Test");  
service.setUserCredentials(GoogleUserName, GooglePassword);  
CalendarEntry calendar = new CalendarEntry();  
calendar.TimeZone = "America/Chicago";  
calendar.Title.Text = Title;  
calendar.Summary.Text = Description;  
calendar.Color = Color;  
calendar.Selected = true;  
calendar.Hidden = false;  

Uri postUri = new Uri(String.Format("http://www.google.com/calendar/feeds/{0}/owncalendars/full", GoogleAccount));  
CalendarEntry createdCalendar = (CalendarEntry)service.Insert(postUri, calendar);  

The documentation does specify to use the users credentials however the documentation is not specific to hosted domains a great deal of the time and as such I am always attempting trial and error when trying interactions. That I can use all of the CRUD on the user's events themselves using the admin credentials leaves me to believe that it might be possible.

© Stack Overflow or respective owner

Related posts about google-calendar-api