karishmal / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

Service.Insert(Uri, EventEntry) doesn't return anything #388

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here is the code :

FeedQuery query = new FeedQuery();
Service service = new Service("cl", "AppName");
service.setUserCredentials("login", "password");

EventEntry entry = new EventEntry();
entry.Title.Text = "Redo the bug";
entry.Content.Content = "The application should crash";
entry.Times.Add(new When(DateTime.Parse("2013-08-29 11:00"), 
DateTime.Parse("2013-08-29 12:00")));

Uri postUri = new 
Uri("http://www.google.com/calendar/feeds/myemail/private/full");

EventEntry insertedEntry = service.Insert(postUri, entry) as EventEntry;

// insertedEntry is null then next line will crash
return insertedEntry.EventId;

The event is correctly created on my calendar, but the method doesn't return 
the created object.
So I can't manage it (I need to store the created ID in order to update/delete 
then easily)

Using those dependencies, current version :
Google.GData.Client;
Google.GData.Extensions;
Google.GData.Calendar;

Windows Seven 64 bits
Visual Studio 2012 For Desktop Express
Framework 4.0
Windows Form application.

Original issue reported on code.google.com by administ...@manga-torii.com on 29 Aug 2013 at 7:34

GoogleCodeExporter commented 9 years ago
I'm closing this issue because your'e working with GData library - 
https://code.google.com/p/google-gdata/issues/list.

Why aren't you working with this library - you can use our 
http://www.nuget.org/packages/Google.Apis.Calendar.v3 and then install also 
Google.Apis.Authentication 
(https://www.nuget.org/packages/Google.Apis.Authentication) package.

There is a calendar sample available here: 
https://code.google.com/p/google-api-dotnet-client/source/browse?repo=samples#hg
%2FCalendar.VB.ConsoleApp, although it's a VB sample.

Good luck!

I'm closing this issue, feel free to reopen it if you feel like...

Original comment by pele...@google.com on 29 Aug 2013 at 1:16

GoogleCodeExporter commented 9 years ago
I can't use the Google.Apis.Calendar.v3 library because of those reasons :
1/ I didn't found a way to make it work without opening an authentification 
window. My program will be a scheduled task without interaction
2/ The sample program doesn't work and is VB.NET, not C#. Thus, it's not 
complete, it doesn't even show how to create an event
3/ I was unable to find a tutorial or more detailed sample with this API, and I 
never succed to make it working
4/ When I found a way to make it work, the create event didn't break, but 
nothing was created in the calendar. Thus, queries on the calendar were showing 
me old events, and never the new updates (like if it was a snapshop for my 
calendar a few month ago)

For all those reasons, I can't use Google.Apis.Calendar.v3
May you know a good tutorial or complete C# (Windows Form) sample ?

Original comment by administ...@manga-torii.com on 29 Aug 2013 at 2:41