在Google日历中插入事件 [英] Insert event in google calender

查看:88
本文介绍了在Google日历中插入事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我创建了一个活动,并使用查询
将其上传到了Google日历中

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);



插入时,它将进入默认的压延机.需要在我创建的Mynewcalender中添加此事件.怎么可能..谁能帮助我????



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???

推荐答案

您正在将其发布到仅您的默认日历:
You are posting it up to your default calendar only:
postUri = new Uri("http://www.google.com/calendar" + "/feeds/default/private/full");



您需要设置正确的Uri才能将其发布到另一个日历.
不确定,但是我认为应该是这样的:



You need to set the correct Uri for posting it to another calendar.
Not sure, but I think it should be something like:

postUri = new Uri("http://www.google.com/calendar" + "/feeds/MYNEWCLAENDAR/private/full");


这篇关于在Google日历中插入事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆