0

Google カレンダー API に関して、予定の [プライバシー] フィールド (公開/非公開/デフォルト) が表示されないようです。

イベントの「プライバシー」フィールドを取得する方法はありますか? つまり、Public/Private/Default - または、これは利用できませんか?

4

3 に答える 3

1

イベントの「プライバシー」フィールドを取得することはできませんが、クエリで (public\private) イベントをフィルタリングする必要があります。

query = gdata.calendar.service.CalendarEventQuery('default', 'private', 'full')
feed = calendar_service.CalendarQuery(query)

CalendarEventQuery の 2 番目のパラメーターは可視性 (private\public) です。

イベントフィードもご覧ください。

于 2010-04-01T14:24:59.473 に答える
0

わたしにはできる。イベントのプライバシーを変更または表示することができます。

CalendarEventFeed resultFeed = myService.query(myQuery, CalendarEventFeed.class);

// Goes through all events.
System.out.println("Updating events from " + startTime.toString() + " to " + endTime.toString() + ":\n");
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
  // Obtains the entry.
  CalendarEventEntry entry = resultFeed.getEntries().get(i);

  // Changes the visibility to private and update the entry.
  //entry.getVisibility().setValue(Visibility.PRIVATE_VALUE);
  //entry.update();

  // Print some information in the output.
  System.out.println("- " + entry.getTitle().getPlainText() + " -- Visibility is now: " + entry.getVisibility().getValue());
}

「可視性を非公開に変更します」コメントの後の行のコメントを外すと、このコードはデフォルトのカレンダーですべてのイベントを非公開に変更します (myServiceが適切に設定され、すべてのイベントを返すクエリであると仮定します) CalendarServicemyQuery

これがお役に立てば幸いです - Vítor Souza

于 2011-07-12T09:27:16.860 に答える