Microsoft Exchange Server 2016 PowerShell Cookbook - Fourth Edition
by Jonas Andersson, Nuno Mota, Mike Pfeiffer
How it works...
In order to access a mailbox using the permissions of an impersonated user, we use RBAC to create a management role assignment for the user that will be calling the code. Like any other management role assignment, this can be done directly for one user or to a group. Keep in mind that you can also associate scopes when assigning the ApplicationImpersonation role. The command shown in our example would give the administrator account impersonation rights to any mailbox in the organization.
Once we have impersonation rights, we load the EWS Managed API assembly and create an instance of the ExchangeService class to bind to the EWS endpoint.
Notice that, when we create the $id object, we're creating an instance of the ImpersonatedUserId ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access