Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to connect to onpremise EWS #1

Open
mutulong opened this issue Sep 5, 2020 · 8 comments
Open

How to connect to onpremise EWS #1

mutulong opened this issue Sep 5, 2020 · 8 comments

Comments

@mutulong
Copy link

mutulong commented Sep 5, 2020

Hi hmmwhatsthisdo,

I tried the module on our onpremise exchange server, I would load the module just fine, but I spent hours to figure out how to connect the EWS, can you shed some lights how to do that?

Thank you.
image

@hmmwhatsthisdo
Copy link
Owner

hmmwhatsthisdo commented Sep 5, 2020

I was only able to test this module with O365, so it's possible that on-prem Exchange with other authentication methods (Kerberos, ADFS, etc.) might not work as expected.

You can try modifying L83 of PSEWS\Public\Connect-EWS.ps1 to forward the exception returned by .AutoDiscoverUrl() through the -Exception parameter of Write-Error:

Write-Error -Exception $_ <# other parameters #>

That should expose the error returned by .AutoDiscoverUrl() via $error. You might have to dig through .Exception/.InnerException to find the exception thrown by .AutoDiscoverUrl() instead of the one thrown by PowerShell.

Unfortunately I don't have an Exchange instance to work with at the moment (on-prem or cloud/O365), so it's difficult for me to provide a whole lot of insight here.

@mutulong
Copy link
Author

mutulong commented Sep 6, 2020

Thank you for your prompt reply, apology for being a noob of Powershell.

Any chance you could let me know how to use Conncet-EWS? specifically, where to add the AutoDiscoverUrl?

@mutulong
Copy link
Author

mutulong commented Sep 6, 2020

This doesn't seem to work, but there is no error messages

image

@hmmwhatsthisdo
Copy link
Owner

When provided an endpoint URL, all Connect-EWS will do to validate connectivity is attempt to bind to the root folder of the default mailbox. You can use -Verbose to see output from it stepping through this process - no output means you're likely already connected.

@mutulong
Copy link
Author

mutulong commented Sep 6, 2020

Thanks for your reply.
I could connect to EWS now, but I don't think Get-EWSMailboxDelegate works, the user has a few delegates in Full Access and Send As, but none of them shows up in the console.
image

@mutulong
Copy link
Author

mutulong commented Sep 6, 2020

To prove the connection works -
image

@mutulong
Copy link
Author

mutulong commented Sep 6, 2020

Set-EWSMailboxDelegate also gives this error, am I missing something here?

image

@hmmwhatsthisdo
Copy link
Owner

Apologies, I had GitHub notifications going off into the ether apparently.

Get-EWSMailboxDelegate is essentially a wrapper around Microsoft.Exchange.WebServices.Data.ExchangeService.GetDelegates() - if that's returning nothing, it's likely these aren't "true" delegates in the Exchange sense. IIRC Exchange Delegates are tabulated in like 3 different places, so it's possible that Full Control on the mailbox and Send As doesn't cut it.

What happens when you run Add-EWSMailboxDelegate? Does that work as expected and return results from Get-/Update-EWSMailboxDelegate? Does loading this mailbox in Outlook/OWA show these users are delegates?

(I haven't touched Exchange in north of 2 years, so there's not a lot I can do here.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants