Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to add a new calendar from GUI, is it possible or not?
I can retrieve all calendars but don't know how to add.

//Retrieve all calendars for an account
   private CalendarFeed RetrievingOwnGoogleCalendars()
   {
     CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
     myService.setUserCredentials(textBoxUsrName.Text, textBoxPassword.Text);

     CalendarQuery query = new CalendarQuery();
     query.Uri = new Uri ("http://www.google.com/calendar/feeds/default/owncalendars/full");
     CalendarFeed resultFeed = myService.Query(query);
     return resultFeed;
    }


Need a method to add a new one.
Posted
Updated 28-Sep-12 7:00am
v2

I found the answer;


public CalendarEntry CreateCalendar(string title, string summary, string timezone, bool ispublic)
{
    CalendarEntry calendar = new CalendarEntry();
    calendar.Title.Text = title;
    calendar.Summary.Text = summary;
    calendar.TimeZone = timezone;


    Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full");
    CalendarEntry createdCalendar = (CalendarEntry) _calendarService.Insert(postUri, calendar);

    return createdCalendar;
}
 
Share this answer
 
Comments
chroensch 11-Jan-13 9:03am    
works like a charm, but how can i delete a calendar?

to be onest i try this with php, but as you can see with the create examples of above, it doesn't really matters.

Greetings
Grunge
I don't think you will be able to add new data from the way you are getting information is the code you have given.
But, you can do that using Google API's provided by Google.
Following links may help you:
http://stackoverflow.com/questions/2150245/adding-an-event-to-a-specific-google-calender-with-gdata-api[^]
http://stackoverflow.com/questions/1534373/google-calendar-api-selecting-creating-calendars[^]

Hope this will help you.

~Amol
 
Share this answer
 
Comments
Emre Ataseven 28-Sep-12 13:25pm    
I am already using Google API. The second link u gave me, i think it could light my way, but i can not figure out that code;

if($noAppCal) {

// I actually had to guess this method based on Google API's "magic" factory
$appCal = $gdataCal -> newListEntry();
// I only set the title, other options like color are available.
$appCal -> title = $gdataCal-> newTitle("App Calendar");

//This is the right URL to post to for new calendars...
//Notice that the user's info is nowhere in there
$own_cal = "http://www.google.com/calendar/feeds/default/owncalendars/full";

//And here's the payoff.
//Use the insertEvent method, set the second optional var to the right URL
$gdataCal->insertEvent($appCal, $own_cal);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900