1

以下のコードを使用して、Googleカレンダーでリマインダーを作成しています(c#用のGoogle API ver 2を使用):

    EventEntry entry = new EventEntry();

    entry.Title.Text = "testing from .NET";
    entry.Content.Content = "testing from .NET";

    String recurData =
   "DTSTART;TZID=America/Los_Angeles:20071202T080000\r\n" +
   "DTEND;TZID=America/Los_Angeles:20071202T090000\r\n" +
   "RRULE:FREQ=WEEKLY;WKST=SU;UNTIL=20071230T160000Z;BYDAY=SU\r\n";

   Recurrence recurrence = new Recurrence();
   recurrence.Value = recurData;
   entry.Recurrence = recurrence;

   Reminder reminder = new Reminder();
   reminder.Minutes = 15;
   reminder.Method = Reminder.ReminderMethod.all;   
   entry.Reminders.Add(reminder);

エラーの取得:オブジェクト参照がオブジェクトのインスタンスに設定されていません。

ありがとう

4

3 に答える 3

1

エントリは存在しますか?もしそうなら、リマインダーは存在しますか?(私は両方ともNULLではないことを意味します)

APIリンクから判断します。リマインダーを設定する前に、イベントをカレンダーに追加する必要があります。

Uri postUri = new Uri("http://www.google.com/calendar/feeds/default/private/full");
EventEntry createdEntry = (EventEntry) service.Insert(postUri, myEntry);
//and then add reminders

これを参照してください

私はGoogleAPIを使用したことがないため、機能するかどうかを保証できません。アプリケーションをデバッグし、EventEntryとRemindersの値を確認する必要があります

于 2010-04-14T08:19:47.210 に答える
1
CalendarEventEntry saveEntry = myService.insert(eventFeedUrl, entry);

saveEntry.getReminder().add(reminder);

*アクションを挿入/更新した後にリマインダーを追加する必要があります

于 2011-06-14T13:44:42.600 に答える
0

「エントリ」オブジェクトの更新を完了する必要があります。リマインダーオブジェクトを設定した後、 entry.Update()を使用 します。これがお役に立てば幸いです。

于 2010-04-14T14:44:06.387 に答える