This function queries the AlternateMailboxes node within a user's AutoDiscover response. It uses invoke-webrequest to fetch the user's XML and then parses the response to return an array of delegates.

 

Please read the blog post for more information, including solution to a recent breaking change introduced by Microsoft: http://mikecrowley.us/2017/12/08/querying-msexchdelegatelistlink-in-exchange-online-with-powershell