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.