getEvents(startDateSecondsUTC, endDateSecondsUTC, calendars?, options)

指定されたカレンダーから、指定された日付範囲にあるすべての行動を返します。

構文 

1import { getCalendarService } from 'lightning/mobileCapabilities';
2getEvents(
3  startDateSecondsUTC: number,
4  endDateSecondsUTC: number,
5  calendars?: string[],
6  options: CalendarServiceOptions
7  ): Promise<Object>

パラメータ 

  • startDateSecondsUTC — (必須) 日付範囲の開始日。
  • endDateSecondsUTC — (必須) 日付範囲の終了日。
  • calendars — (省略可能) 行動を取得するカレンダーのタイトル。指定ない場合、または NULL が渡された場合、行動は利用可能なすべてのカレンダーから取得されます。
  • options — (必須) 日付範囲の開始日。
  • options — CalendarService 要求を設定するための CalendarServiceOptions オブジェクト。

戻り値 

Calendar オブジェクトの配列として解決される Promise オブジェクト。エラーが発生すると、配列は空になります。

使用方法 

この関数は、指定した日付範囲にあるすべての行動を指定したカレンダーから取得するために使用します。

1myCalendarService
2  .getEvents(options)
3  .then((results) => {
4    this.events = results;
5  })
6  .catch((error) => {
7    this.events = [];
8    console.error("Error code: " + error.code);
9    +console.error("Error message: " + error.message);
10  });
  • calendars プロパティが null の場合、行動は利用可能なすべてのカレンダーから取得されます。
  • エラーが発生すると、却下された Promise を介してエラーが返されます。catch 句でエラーを処理します。

The Japanese Summer '24 guide is now live

日本語の Summer '24 ガイドが公開されました! 「Component Reference (コンポーネントリファレンス)」は、以前と同様にコンポーネントライブラリにあります。