2014-11-20 2 views
-2

내 응용 프로그램에서 Google 캘린더에 이벤트를 추가하려고하면 다음 오류가 발생합니다. 다음과 같이.net 응용 프로그램에서 내 Google 캘린더의 모든 이벤트 가져 오기

내 코드는 다음과 같습니다 - '

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Net; 
using System.Web.UI.WebControls; 
using Google.GData.Calendar; 
using Google.GData.Extensions; 
using Google.GData.AccessControl; 
using Google.GData.Client; 
public partial class Calender : System.Web.UI.Page 
{ 
    public static Uri oCalendarUri; 
    protected void Page_Load(object sender, EventArgs e) 
    { 
     //eventEntry(); 
     try{ 
      string sGoogleUserName = "[email protected]"; 
      string sGooglePassword = "xxxxxxxx"; 
      Uri oCalendarUri = new Uri("http://www.google.com/calendar/feeds/" + sGoogleUserName + "/private/full"); 

      //Initialize Calendar Service 
      CalendarService oCalendarService = new CalendarService("API Project"); 
      oCalendarService.setUserCredentials(sGoogleUserName, sGooglePassword); 

      //Use Proxy 
      //GDataRequestFactory oRequestFactory = (GDataRequestFactory)oCalendarService.RequestFactory; 
      //WebProxy oWebProxy = new WebProxy(WebRequest.DefaultWebProxy.GetProxy(oCalendarUri)); 
      //oWebProxy.Credentials = CredentialCache.DefaultCredentials; 
      //oWebProxy.UseDefaultCredentials = true; 
      //oRequestFactory.Proxy = oWebProxy; 


      //Set Event Entry 
      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"; 

      //Set Event Location 
      Where oEventLocation = new Where(); 
      oEventLocation.ValueString = "New Zealand"; 
      oEventEntry.Locations.Add(oEventLocation); 

      //Set Event Time 
      When oEventTime = new When(new DateTime(2011, 5, 31, 9, 0, 0), new DateTime(2011, 5, 31, 9, 0, 0).AddHours(1)); 
      oEventEntry.Times.Add(oEventTime); 

      //Set Additional Properties 
      ExtendedProperty oExtendedProperty = new ExtendedProperty(); 
      oExtendedProperty.Name = "SynchronizationID"; 
      oExtendedProperty.Value = Guid.NewGuid().ToString(); 
      oEventEntry.ExtensionElements.Add(oExtendedProperty); 

      // CalendarService oCalendarService = GAuthenticate(); 

      //Prevents This Error 
      //{"The remote server returned an error: (417) Expectation failed."} 
      System.Net.ServicePointManager.Expect100Continue = false; 

      //Save Event 
      oCalendarService.Insert(oCalendarUri, oEventEntry); 
     } 
     catch (Exception ex) 
     { 
      Response.Write(ex.Message); 
     } 
    }` 

오류가있어'요청의 실행이 실패 : https://www.google.com/calendar/feeds/[email protected]/private/full '

답변

0

을 나는 구글의 API V3를 사용하여이 문제를 해결했다. 이제 응용 프로그램이 정상적으로 작동합니다.

관련 문제