I have an async function that pulls emails from Office365. The application will send emails with no difficulty using the graphServiceClient but when I ask for the inbox contents I end up with a blocking line when I await (ie the following line of code is never reached, 'messages' is never populated):
messages = Await graphClientService.Users(ID).MailFolders.Inbox.Messages.Request.GetAsync
I then rewrote synchronously and the call now works and does not block:
messages = graphClientService.Users(ID).MailFolders.Inbox.Messages.Request.GetAsync.GetAwaiter.GetResult
Everything I read says the latter is bad practice as it will block the thread in the event of a mishap - but the asynchronous call hangs the thread completely.
Am I missing something in my Async implementation? This feels like my naivety but days of googling has yielded nothing.