c# - Universal Windows Platform App with google calendar -
hey im trying make universal windows platform app google calendar in it, cant figure out how convert code, got code work on wpf app. not best @ coding https://developers.google.com/google-apps/calendar/quickstart/dotnet site use guideline in start if help, help? code below:
using system; using system.collections.generic; using system.io; using system.linq; using system.text; using system.threading; using system.threading.tasks; using google.apis.auth.oauth2; using google.apis.calendar.v3; using google.apis.calendar.v3.data; using google.apis.services; using google.apis.util.store; namespace test1uwa { class googleevents4 { public string title { get; set; } public datetime? startdate { get; set; } public datetime? enddate { get; set; } } class googleclass4 { public list<googleevents4> googleevents = new list<googleevents4>(); static string[] scopes = { calendarservice.scope.calendarreadonly }; static string applicationname = "google calendar api .net quickstart"; public googleclass4() { usercredential credential; using (var stream = new filestream("client_secret4.json", filemode.open, fileaccess.read)) { string credpath = system.environment.getfolderpath( system.environment.specialfolder.personal); credpath = path.combine(credpath, ".credentials/calendar-dotnet-quickstart.json"); credential = googlewebauthorizationbroker.authorizeasync( googleclientsecrets.load(stream).secrets, scopes, "user", cancellationtoken.none, new filedatastore(credpath, true)).result; } // create google calendar api service. var service = new calendarservice(new baseclientservice.initializer() { httpclientinitializer = credential, applicationname = applicationname, }); // define parameters of request. eventsresource.listrequest request = service.events.list("primary"); request.timemin = datetime.now; request.showdeleted = true; request.singleevents = true; request.maxresults = 10; request.orderby = eventsresource.listrequest.orderbyenum.starttime; // list events. events events = request.execute(); if (events.items != null && events.items.count > 0) { foreach (var eventitem in events.items) { string when = eventitem.start.datetime.tostring(); if (string.isnullorempty(when)) { when = eventitem.start.date; } googleevents.add(new googleevents4 { title = eventitem.summary, startdate = eventitem.start.datetime, enddate = eventitem.end.datetime }); } } } } }
at time google .net client library not support uwp.
link client library (supported platform list)
chrisdunelm 27 days ago google member unfortunately don't support uwp yet, can't on list yet. maybe should highlight don't support :(
update:
we plan support uwp in v2.0 release, hope 2017.
Comments
Post a Comment