caroalvarezsilva / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

.NET NullReferenceException when adding Reminder to entry.Reminders #475

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Moved from 
http://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=1915

Name of API affected:
Calendar Data .NET API

Issue summary:
Provide a brief summary of the issue you're experiencing.

Problem: nullreference exception on adding Reminder to entry.Reminders

Workaround: Add to When, add When to entry.Times instead

Outcome: Workaround only works for single events.

Steps to reproduce issue:

1. Use the following code from the .NET API Docs to add a Reminder to 
any event, recurring or single:

Reminder fifteenMinReminder = new Reminder();
fifteenMinReminder.Minutes = 15;
fifteenMinReminder.Method = Reminder.ReminderMethod.email;
entry.Reminders.Add(fifteenMinReminder);
entry.update();

Expected output:

Reminder added to EventEntry

Actual results:

NullReferenceException on entry.Reminders.Add(fifteenMinReminder);

Notes:

This happens despite the affirmation by Austin (Google) on 
http://groups.google.com/group/google-calendar-help-
dataapi/browse_thread/thread/bc98afb472fe3014/f36ac2356b85b41b?
lnk=gst&q=Re:+Alarms+on+recurring+events+via+protocol%3F#f36ac23
56b85b41b 

that:

 You can insert reminder to a recurring event with a 
<gd:reminder>element directly to the <entry> element, since there is no 
<gd:when> element (which is the normal place where reminder typically 
goes for single event).

To test I added a reminder directly under the gd:recurrence for recurring 
events in the XML and this does indeed work fine, so I presume this is a 
bug in the .NET API?

Original issue reported on code.google.com by ccherub...@google.com on 2 Feb 2011 at 9:40

GoogleCodeExporter commented 8 years ago
I tried adding a Reminder with the posted code to both single and recurring 
events and it worked without exception.

Marking this issue as Invalid.

Original comment by ccherub...@google.com on 7 Feb 2011 at 1:26

GoogleCodeExporter commented 8 years ago
I had same error with same code.
Is not invalid.

Original comment by RafaelEs...@gmail.com on 19 May 2011 at 12:45

GoogleCodeExporter commented 8 years ago
Are you using the latest version of the client library?

Original comment by ccherub...@google.com on 19 May 2011 at 12:51

GoogleCodeExporter commented 8 years ago
I have the same error with same code too.
I use the latest version (1.8) of the Google.GData.Calendar.dll.

Original comment by aranyjan...@gmail.com on 23 Jul 2011 at 2:48

GoogleCodeExporter commented 8 years ago
Maybe the When must be before? If i change the order (it should be then first 
When, and after then Reminder), then it is all right. Or it can be the line 
"entry.Notifications = true;" too; Now is that line also before the adding the 
reminders to entry.

Original comment by aranyjan...@gmail.com on 23 Jul 2011 at 3:31

GoogleCodeExporter commented 8 years ago
Please capture the HTTP traffic with Fiddler and share it here (in plain text 
format).

Original comment by ccherub...@google.com on 23 Jul 2011 at 3:59

GoogleCodeExporter commented 8 years ago
Sorry, i'm late actually, but as i wrote, it's all right by me now. I think, it 
was the order, but i can't tell wich line was it exactly. Now my order:
0. Setting the reminders.
1. Setting up "When".
2. Adding "When" to event.
2. Switch notification on.
3. Adding reminders to event.
Now works like a charm.

Original comment by aranyjan...@gmail.com on 23 Jul 2011 at 4:30