while (calFeed != null && calFeed.Entries.Count > 0)
{
// look for the one with dinner time...
foreach (AtomEntry entry in calFeed.Entries)
{
entry.Delete();
iCount++;
Tracing.TraceMsg("CalendarCleanup = deleting entry" + iCount);
}
// just query the same query again.
calFeed = service.Query(query);
}
You should not have problems with the NextChunk property in general, what's the problem you got? I found that it is not useful for the delete job, as the server, when you start deleting, would end up skipping entries...
Frank Mantek
On 9/29/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Jenyphur wrote:
>
> Can you post your code so I can see if we are doing things the same
> way? Thanks.
>
My code is very standard and as follows. One important point is that I
found it possible to make use of the ".NextChunk()" method; doing so
always returned a result that was incompatible with the query.Uri
property, so resulting in a run-time abort. In the end I just read all
the events in one go.
John
Precis of code:
string calendarURI = "myUrl";
string userName = " [EMAIL PROTECTED]";
string passWord = "mypassword";
EventQuery query = new EventQuery();
CalendarService service = new
CalendarService(ApplicationName);
if (userName != null)
{
service.setUserCredentials(userName, passWord);
}
query.Uri = new Uri(calendarURI);
query.NumberToRetrieve=999 ;
EventFeed calFeed = service.Query(query);
DeleteEvents (calFeed, query, service);
private void DeleteEvents (EventFeed calFeed,
EventQuery query,
CalendarService service){
int i=0;
while (calFeed != null && calFeed.Entries.Count > 0)
{
foreach (EventEntry entry in calFeed.Entries){
i++;
Response.Write (i.ToString() + " Deleting: " + entry.Title.Text +
"<br />");
entry.Delete();
}
calFeed = null;
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi
-~----------~----~----~----~------~----~------~--~---
