hoangduit / google-gdata

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

Recurrence Exceptions not working #388

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Setting the following values now results in a "Element must contain value 
for attribute specialized" exception when the entry is inserted.

                var originalEvent = new OriginalEvent
                                    {
                                        IdOriginal = 
masterEventEntry.EventId,
                                        Href = 
masterEventEntry.SelfUri.Content
                                    };
                var origTime = new When();

                if (masterEventEntry.Times[0].AllDay)
                {
                    origTime.AllDay = true;
                    originalEvent.OriginalStartTime = origTime;
                }
                else
                {
                    origTime.AllDay = false;
                    origTime.StartTime = 
masterEventEntry.Times[0].StartTime;
                    origTime.EndTime = masterEventEntry.Times[0].EndTime;
                    originalEvent.OriginalStartTime = origTime;
                }

                entry.OriginalEvent = originalEvent;
            }

            var recurrenceException = new RecurrenceException();
            string recurExData =
              string.Format("DTSTART:{0:yyyyMMddTHHmmss}Z\r\n", 
appointment.StartDate.ToUniversalTime()) +
              string.Format("DTEND:{0:yyyyMMddTHHmmss}Z\r\n", 
appointment.EndDate.ToUniversalTime()) +
              string.Format("RECURRENCE-ID:{0:yyyyMMddTHHmmss}Z\r\n", 
masterAppointment.StartDate.ToUniversalTime());
            recurrenceException.Value = recurExData;
            if (appointment.StartDate.Equals(masterAppointment.StartDate) 
&& appointment.EndDate.Equals(masterAppointment.EndDate)
                && appointment.Location.Equals(masterAppointment.Location))
            {
                recurrenceException.Specialized = false;
            }
            else
            {
                recurrenceException.Specialized = true;
            }
            entry.Times.Add(new When(appointment.StartDate, 
appointment.EndDate));
            entry.RecurrenceException = recurrenceException;

I getting the following info from the exception.

A first chance exception of type 
'Google.GData.Client.GDataRequestException' occurred in 
Google.GData.Client.dll
The thread '<No Name>' (0x694) has exited with code 0 (0x0).
Error: Error: System.Net.HttpWebResponse, Response String: Element must 
contain value for attribute specializedInnerException: 
System.Net.WebException: The remote server returned an error: (400) Bad 
Request.
   at System.Net.HttpWebRequest.GetResponse()
   at Google.GData.Client.GDataRequest.Execute()Stack Trace:    at 
Google.GData.Client.GDataRequest.Execute()
   at Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter)
   at Google.GData.Client.GDataGAuthRequest.Execute()
   at Google.GData.Client.Service.EntrySend(Uri feedUri, AtomBase 
baseEntry, GDataRequestType type, AsyncSendData data)
   at Google.GData.Client.Service.Insert(Uri feedUri, AtomEntry newEntry, 
AsyncSendData data)
   at Google.GData.Client.Service.Insert[TEntry](Uri feedUri, TEntry entry)

What is the expected output? What do you see instead?
Expect recurrence exception to be created. However every recurrence 
exception I attempt to create gives me the same error. This code was 
working with originally posted release build.

What version of the product are you using? On what operating system?
I'm using the latest build as of 6/5/2010

Original issue reported on code.google.com by steve.wa...@gmail.com on 6 Jun 2010 at 4:57

GoogleCodeExporter commented 9 years ago
I seriously doubt that code was ever working. I guess something on the server 
has 
changed to make this problem appear though. When you look into the code for 
RecurrenceException, this one does NOT have any kind of persistence method It 
just 
writes out <recurrenceException/> with no subelement (like specialized etc). 
That code 
was not touched since october 2008. 

So i guess i need to change something here...

Original comment by fman...@gmail.com on 7 Jun 2010 at 2:13

GoogleCodeExporter commented 9 years ago
I checked in a new version of recurrenceexception.cs. Please compile and try 
this 
again, i am hopeful that this is now working. It looks like features of the V2 
version 
of the Calendar DLL are creeping into the V1 feed, so it's probably time to 
switch the 
calendar .NET requests to use V2. I will do that in a later checkin.

Original comment by fman...@gmail.com on 7 Jun 2010 at 2:41

GoogleCodeExporter commented 9 years ago
It appears this issue is still a problem. I'm now getting the following when 
creating exceptions.

Error: System.Net.HttpWebResponse, Response String: Element must contain value 
for attribute special
izedInnerException: System.Net.WebException: The remote server returned an 
error: (400) Bad Request.

   at System.Net.HttpWebRequest.GetResponse()
   at Google.GData.Client.GDataRequest.Execute()Stack Trace:    at Google.GData.Client.GDataRequest.
Execute()
   at Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter)
   at Google.GData.Client.GDataGAuthRequest.Execute()
   at Google.GData.Client.Service.EntrySend(Uri feedUri, AtomBase baseEntry, GDataRequestType type,
AsyncSendData data)
   at Google.GData.Client.Service.Insert(Uri feedUri, AtomEntry newEntry, AsyncSendData data)
   at Google.GData.Client.Service.Insert[TEntry](Uri feedUri, TEntry entry)
   at Quest.Apollo.MigrationProvider.GMail.AppointmentApi.Insert(Uri uri, EventEntry eventEntry) in
C:\Users\swarwick\Documents\Visual Studio 
2010\Projects\Apollo\Source\Apollo.MigrationProvider.GMail

Original comment by steve.wa...@gmail.com on 10 Jun 2010 at 9:26

GoogleCodeExporter commented 9 years ago
Steve, i need a wiretrace. I have testcases that work, so there must be 
edgecases that don't. Code & wiretrace if possible. I will fix this as soon as 
i can.

Frank

Original comment by fman...@gmail.com on 22 Jun 2010 at 9:14

GoogleCodeExporter commented 9 years ago
Issue 391 has been merged into this issue.

Original comment by ccherub...@google.com on 7 Dec 2010 at 8:44

GoogleCodeExporter commented 9 years ago

Original comment by ccherub...@google.com on 18 Mar 2011 at 1:42

GoogleCodeExporter commented 9 years ago
If this is still an open issue, please provide the complete sample code and 
HTTP traffic capture as requested.

Original comment by ccherub...@google.com on 2 Aug 2011 at 11:00