Google api 使用访问令牌在Google日历中插入数据

Google api 使用访问令牌在Google日历中插入数据,google-api,google-calendar-api,access-token,Google Api,Google Calendar Api,Access Token,跟随谷歌oAuth -1.我已通过客户ID和机密ID获取代码 -2.交换该代码以获取访问令牌 -3.现在我想在谷歌日历中插入删除和搜索数据/事件,使用我可用的访问令牌,而不是用户凭证。请告诉我我做错了什么 获取错误: 执行请求失败: 在这方面有人能帮忙吗 Uri oCalendarUri; ExtendedProperty oExtendedProperty; void Insert() { Google.GData.Calendar.EventEntry oEventEntry

跟随谷歌oAuth -1.我已通过客户ID和机密ID获取代码 -2.交换该代码以获取访问令牌 -3.现在我想在谷歌日历中插入删除和搜索数据/事件,使用我可用的访问令牌,而不是用户凭证。请告诉我我做错了什么

获取错误: 执行请求失败:

在这方面有人能帮忙吗

 Uri oCalendarUri;
ExtendedProperty oExtendedProperty;

 void Insert() 
{
    Google.GData.Calendar.EventEntry oEventEntry = new Google.GData.Calendar.EventEntry();
    oEventEntry.Title.Text = "Test Calendar Entry From .Net";
    oEventEntry.Content.Content =
      "Hurrah!!! I posted my first Google calendar event through .Net";


    Where oEventLocation = new Where();
    oEventLocation.ValueString = "New Zealand";
    oEventEntry.Locations.Add(oEventLocation);

    When oEventTime = new When(new DateTime(2014, 9, 26, 09, 0, 0),
 new DateTime(2014, 9, 26, 12 , 0, 0).AddHours(2));
    oEventEntry.Times.Add(oEventTime);

    oExtendedProperty = new ExtendedProperty();
    oExtendedProperty.Name = "SynchronizationID";
    oExtendedProperty.Value = Guid.NewGuid().ToString();
    myValue = oExtendedProperty.Value;
    oEventEntry.ExtensionElements.Add(oExtendedProperty);

    CalendarService oCalendarService = GAuthenticate();
    System.Net.ServicePointManager.Expect100Continue = false;

    //Save Event        
    oCalendarService.Insert(oCalendarUri, oEventEntry);  
}

 private CalendarService GAuthenticate()
{

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

    CalendarService oCalendarService = new CalendarService("CalendarSampleApp");
    string token = Session["token"].ToString();        
    oCalendarService.SetAuthenticationToken(token);

    return oCalendarService;
}

您正在使用的api已弃用,将于今年11月关闭()。请将代码更新为最新的API,您可以在此处找到迁移指南:

运行已获得的代码时发生了什么?大概是出了什么问题,但是你没有说什么……另外,这是v2api吗?您可能想考虑使用V3:我正在获取这个错误:请求的执行失败:我真的被困在谷歌文档及其版本中,请指导我实现我的动机。我已经访问了获取或操作google api所需的令牌。No。发布新问题-停止在此问题上添加评论。先生,我的意思是如何从asp.net调用google calender v3的rest api?如何通过RESTAPI应用insert…有一个dotnet客户端库:查看底部的示例。