Google カレンダー API に関して、予定の [プライバシー] フィールド (公開/非公開/デフォルト) が表示されないようです。
イベントの「プライバシー」フィールドを取得する方法はありますか? つまり、Public/Private/Default - または、これは利用できませんか?
Google カレンダー API に関して、予定の [プライバシー] フィールド (公開/非公開/デフォルト) が表示されないようです。
イベントの「プライバシー」フィールドを取得する方法はありますか? つまり、Public/Private/Default - または、これは利用できませんか?
イベントの「プライバシー」フィールドを取得することはできませんが、クエリで (public\private) イベントをフィルタリングする必要があります。
query = gdata.calendar.service.CalendarEventQuery('default', 'private', 'full')
feed = calendar_service.CalendarQuery(query)
CalendarEventQuery の 2 番目のパラメーターは可視性 (private\public) です。
イベントフィードもご覧ください。
わたしにはできる。イベントのプライバシーを変更または表示することができます。
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
が適切に設定され、すべてのイベントを返すクエリであると仮定します) CalendarService
。myQuery
これがお役に立てば幸いです - Vítor Souza