执行请求失败:尝试获取日历列表时

时间:2015-02-26 14:03:25

标签: c# google-api google-calendar-api google-oauth

我使用此代码获取日历列表,但我收到此错误(.NET)

  

执行申请失败:http://www.google.com/calendar/feeds/default

我在谷歌搜索了很多,但没有用

我如何获得获取日历列表的解决方案 params是DataType OAuth2Parameters

GOAuth2RequestFactory rf = new GOAuth2RequestFactory("GoogleIntegration", applicationName, param);

CalendarService cs = new CalendarService(applicationName);
cs.RequestFactory = rf;
CalendarQuery fq = new CalendarQuery();
fq.Uri = new Uri("http://www.google.com/calendar/feeds/default");

CalendarFeed cf = cs.Query(fq);

ds = new DataSet();
dt = new DataTable();
dc = new DataColumn();
dc.DataType = Type.GetType("System.String");
dc.ColumnName = "CalendarName";
dt.Columns.Add(dc);

foreach (CalendarEntry ce in cf.Entries)
{
    DataRow dr = dt.NewRow();
    dr["CalendarName"] = ce.Title;
    dt.Rows.Add(dr);
}
ds.Tables.Add(dt);
gridcalendars.DataSource = ds;
gridcalendars.DataBind();

0 个答案:

没有答案