Click here to Skip to main content
15,888,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I created an event and uploaded in google calender using the query

CalendarService service = new CalendarService(appName);
       
        service.setUserCredentials(userName, password);

        String S =SplitDate(stDate)+ "T00:00:00";
        String E =SplitDate(enDate)+ "T23:59:59";
        
            EventEntry entry = new EventEntry();
            // Set the title and content of the entry.
            entry.Title.Text = title;


            // Set a location for the event.
            Where eventLocation = new Where();
            eventLocation.ValueString = "India";
            entry.Locations.Add(eventLocation);

            string sDate = stDate + " " + stTime;
            string eDate = enDate + " " + enTime;

            DateTime dtstartdatetime = Convert.ToDateTime(sDate);// Convert.ToDateTime(strtime1);//DateTime.Now;
            DateTime dtenddatetime = Convert.ToDateTime(eDate); //Convert.ToDateTime(enDate); //DateTime.Now;

            When eventTime = new When(dtstartdatetime, dtenddatetime);
            entry.Times.Add(eventTime);

            if (userName != null && userName.Length > 0)
            {
                service.setUserCredentials(userName, password);
            }

            Uri postUri;
            postUri = new Uri("http://www.google.com/calendar" +
                              "/feeds/default/private/full");
            GDataGAuthRequestFactory requestFactory =
                (GDataGAuthRequestFactory)service.RequestFactory;
            requestFactory.CreateRequest(GDataRequestType.Insert, postUri);

            // Send the request and receive the response:

            AtomEntry insertedEntry = service.Insert(postUri, entry);


When am inserting this it goes to the default calender . in need to add this event in , Mynewcalender created by me.. How it is possible .. Can anyone help me???
Posted

1 solution

You are posting it up to your default calendar only:
C#
postUri = new Uri("http://www.google.com/calendar" + "/feeds/default/private/full");


You need to set the correct Uri for posting it to another calendar.
Not sure, but I think it should be something like:
C#
postUri = new Uri("http://www.google.com/calendar" + "/feeds/MYNEWCLAENDAR/private/full");
 
Share this answer
 

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