Hi
i am creating task in Google Email using C# in Window service. My code sample is
UserCredential credential;
using (var stream = new FileStream(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "client_secrets.json"), FileMode.Open, FileAccess.Read))
{
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { TasksService.Scope.Tasks },
"[email protected]", CancellationToken.None, new FileDataStore("Tasks.Auth.Store")).Result;
}
// Create the service.
var service = new TasksService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Tasks API Sample",
});
Task task = new Task { Title = "Shyam Task" };
task.Notes = "Please complete me";
task.Due = DateTime.Now.AddHours(2);
Task result = service.Tasks.Insert(task, "@default").Execute();
The above code is written in OnStart method of Window service. The above code sample is run in window form application and Console Application.
I have tried by calling consoleapplication exe from window service but it was not success. Code neither give error not give any message. it only stuck.
Alberto BegliardoPosted May 26, 2014, 7:28 PM
have you got a solution?
I'm developing a windows service that polls on a database and try to synch task...
But, i not understand task api and if it's possible to use via service account (like google calendar api, for example).
Could you give me a hope, a light at the end of tunnel? :)
Thanks, my bests
Alberto