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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -