c# - Simple Google Api example hangs on Outlook Addin -
i have win form called within ribbon inside outlook add-in.
this winform calls following code:
private void lnkreload_linkclicked(object sender, linklabellinkclickedeventargs e) { run().wait(); } private async task run() { // create service. var service = new discoveryservice(new baseclientservice.initializer { applicationname = "discovery sample", apikey = properties.settings.default.clientid }); // run request. console.writeline("executing list request..."); var result = await service.apis.list().executeasync(); // display results. if (result.items != null) { foreach (directorylist.itemsdata api in result.items) { console.writeline(api.id + " - " + api.title); } } }
when debugging code, @ line "car result=await"...
the code stops working. sure can take time, reading list should not take hours.
any clue?
try this:
private async void lnkreload_linkclicked(object sender, linklabellinkclickedeventargs e) { await run(); }
Comments
Post a Comment