David-Barrett-MS / PowerShell-EWS-Scripts

A collection of PowerShell scripts that use EWS to perform actions against Exchange mailboxes
MIT License
118 stars 13 forks source link

ERROR (ThrottledFolderBind): Exception calling "Bind" with "3" argument(s): "The request failed. The remote server returned an error: (401) Unauthorized. #52

Closed creverythingt closed 3 months ago

creverythingt commented 5 months ago

Trying to use Merge-MailboxFolder.ps1. OAUTH has been configured as per the guide. I'm logging into the browser, obtaining a token and receiving the error as per title:

ERROR (ThrottledFolderBind): Exception calling "Bind" with "3" argument(s): "The request failed. The remote server returned an error: (401) Unauthorized." Failed to open source message store (user@domain.com)

During the token obtain process does the admin account used need to have a license, or delegated permission to the source mailbox? My impression was that the oauth app permission was used, so delegation is not needed.

David-Barrett-MS commented 3 months ago

If you are logging in as an account other than the mailbox owner, then you'd need FullAccess permissions on the mailbox to be able to access it. Alternatively, set up application permissions and impersonation. Note that administrators do not have rights to users' mailboxes by default.

creverythingt commented 2 months ago

I had created the app and configured permissions and impersonation correctly - my issue was that I hadn't used the -OAuthSecretKey parameter to actually use the oauth app.