本文介绍了以编程方式将新日历添加到Google日历帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从GUI添加新日历,这有可能吗?
我可以检索所有日历,但不知道如何添加.
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.
推荐答案
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;
}
这篇关于以编程方式将新日历添加到Google日历帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!