2012-07-04 65 views

回答

0

在样品看看:
Getting Started with the .NET Client Library
在链接页面的右侧上面有显示包含在Google Data API solution示例项目的屏幕截图。他们证明是非常有帮助的(我用它们来创建我自己的Google日历应用程序)。

我建议保持您自己的解决方案和样品解决方案打开。这样你可以在示例和你自己的实现之间切换。

我也建议使用NuGet包:

  • Google.GData.AccessControl
  • Google.GData.Calendar
  • Google.GData.Client
  • Google.GData.Extensions
  • and more ...

这样你可以轻松地保持最新状态。


样品,以获得用户的日历:

public void LoadCalendars() 
{ 
    // Prepare service 
    CalendarService service = new CalendarService("Your app name"); 
    service.setUserCredentials("username", "password"); 

    CalendarQuery query = new CalendarQuery(); 
    query.Uri = new Uri("https://www.google.com/calendar/feeds/default/allcalendars/full"); 
    CalendarFeed calendarFeed = (CalendarFeed)service.Query(query); 

    Console.WriteLine("Your calendars:\n"); 
    foreach(CalendarEntry entry in calendarFeed.Entries) 
    { 
     Console.WriteLine(entry.Title.Text + "\n"); 
    } 
} 
+1

我知道这一个。但问题是我不想从用户那里获取密码和用户名。我希望他们在Google上进行身份验证,然后Google向我发送令牌,我想使用令牌并发出请求。有什么方法可以使用令牌并获取日历提要? – Jaggu