2010-01-26 4 views
2

Google 캘린더에서 이벤트 ID별로 CalendarEventEntry을 검색하려고하는데이를 수행 할 방법을 찾을 수 없습니다. Query을 사용하여 피드 캘린더에 쿼리를 작성하는 것이 좋지만 API에서이 방법을 제공하지 않는 것으로 보입니다. 이 단점은 ID가 고려 된 매개 변수 중 하나가 아니라는 것입니다. ID로 단일 Google 캘린더 CalendarEventEntry를받는 방법은 무엇입니까?

CalendarService service = new CalendarService(applicationName); 
service.setUserCredentials(userName,password); 
CalendarEventFeed myFeed = service.getFeed(feedUrl, CalendarEventFeed.class); 
List <CalendarEventEntry> entries = myFeed.getEntries(); 

for (CalendarEventEntry e : entries){ 
    if (e.getId().equals(id)){ 
     return e; 
    } 
    } 

당신은 어떤 더 쉽고 똑바로 알고 있습니까 :

나는 가능한 방법은 다음과 같이 우리의 달력과 관련된 CalendarEventFeed를 가져온 다음 이벤트의 결과 목록을 반복하는 것입니다 달성 할 수 있다고 생각 이것을 달성하는 해결책 ??

미리 감사드립니다.

답변

1

calendarEventEntry.getEditLink().getHref()으로 전화하여 이벤트 URL을 확인할 수 있습니다. 실제로 달력의 URL과 이벤트 ID입니다.

코드 샘플은 Data API Developer Guide입니다.

+0

을하는 데 도움이 괜찮아요하지만 문제가 해결되지 않습니다 바랍니다. ID를 매개 변수로 전달하는 달력 피드를 쿼리하고 달력 이벤트 전달과 함께 반환해야합니다. – markitus82

+0

나는 더 명백해야 했음에 틀림 없다. URL url + 슬래시 + 이벤트 ID를 직접 작성할 수 있습니다. 검색어가 필요하지 않습니다. 개발자 가이드의 '이벤트 업데이트'단락을 살펴보십시오. –

0

사람들의 질문에 기초가 있습니다.이 질문에 답할 코드가 없습니다. 이 질문에 대답하기 위해 사용한 코드를 아래에서 찾으십시오. feedUrl - 그건 당신이 캘린더 설정

이벤트 ID의 형식을 가지고 http://www.google.com/calendar/feeds/email%40gmail.com/events/EventIDLastPart

예를 들어 바닥에있는 달력 URL입니다 : 당신의 코드를 약간

import com.google.gdata.client.*; 
import com.google.gdata.client.calendar.*; 
import com.google.gdata.data.*; 
import com.google.gdata.data.acl.*; 
import com.google.gdata.data.calendar.*; 
import com.google.gdata.data.extensions.*; 
import com.google.gdata.util.*; 

import java.net.*; 
import java.io.*; 
import java.util.List; 


public class GetGoogleCalendarEventByID { 

public static void main(String[] args) { 

    System.out.println("Before Creating CalendarService."); 
    CalendarService myService = new CalendarService("exampleCo-exampleApp-1.0"); 
    System.out.println("After Creating CalendarService."); 


    try 
    {   
     System.out.println("Going to setUserCredentials."); 
     myService.setUserCredentials("[email protected]", "password");   

     URL feedUrl = 
      new URL("https://www.google.com/calendar/feeds/[email protected]/private/full"); 




     CalendarEventFeed myFeed = myService.getFeed(feedUrl, CalendarEventFeed.class); 
     List <CalendarEventEntry> entries = myFeed.getEntries(); 

     for (CalendarEventEntry e : entries){ 
      if (e.getId().equalsIgnoreCase("http://www.google.com/calendar/feeds/email%40gmail.com/events/EventIDLastPart")){ 
       System.out.println("Got the CalendarEventEntry: " + e.getId()); 
       System.out.println("CalendarEventEntry has text: " + e.getPlainTextContent()); 
      } 
      }    


     System.out.println("Finished getting Event.");   




    } 
    catch(Exception e) 
    { 
     System.out.println("Error : " + e.toString()); 

    } 




} 
} 

주 수정

http://www.google.com/calendar/feeds/email%40gmail.com/events/ghytrueueyryrgfuur

는 잘

Ngonidan

관련 문제