2014-09-26 2 views
-1

다음 Google oAuth -1. Client_ID & Secret_ID -2를 통해 코드를 잡았습니다. Access Token 코드를 교환하여 -3. 이제 삭제를 삽입하고 싶습니다. & 데이터/이벤트 검색 사용자 크레딧 정보 대신 나에게 사용 가능한 액세스 토큰을 사용하는 Google 캘린더에서 데이터/이벤트 검색. 내가 뭘 잘못하고 있는지 알려줘.액세스 토큰을 사용하여 Google 캘린더에 데이터 삽입

Getting Error: Execution of request failed: http://www.google.com/calendar/feeds/[email protected]/private/full

아무에게도 도움이 될 수 있습니까?

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; 
} 
+0

이미 작성한 코드를 실행하면 어떻게 될까요? 아마도 무언가 잘못되었지만 당신은 무엇을 말하지 않았습니까? –

+0

또한 이것이 v2 API입니까? v3을 사용하는 것이 좋습니다. https://developers.google.com/api-client-library/dotnet/apis/calendar/v3 –

+0

이 오류는 gettting입니다. 요청 실행에 실패했습니다. http : // www .google.com/calendar/feeds/imenmyself4u @ gmail.com/private/full –

답변

0

사용하고있는 API는 사용되지 않으며 올해 (https://developers.google.com/google-apps/calendar/v2/developers_guide_protocol)의 11 월에 종료됩니다. 코드를 최신 API로 업데이트하십시오. 여기에서 이전 가이드를 찾을 수 있습니다 : https://developers.google.com/google-apps/calendar/migration

+0

선생님은 내가 의미 asp.net에서 구글 캘린더 v3의 나머지 API를 호출하는 방법입니다? 나머지 API를 통해 삽입을 적용하는 방법 –

+0

dotnet 클라이언트 라이브러리가 있습니다. https://developers.google.com/api-client-library/dotnet/apis/calendar/v3 하단의 샘플을 확인하십시오. – luc

관련 문제