OfficeDev / ews-managed-api

Other
584 stars 319 forks source link

How can I create room mailboxes programmatically with EWS ? #189

Open ststeiger opened 6 years ago

ststeiger commented 6 years ago

We have a facility management application, that manages all rooms in a large corporation. One of our customers has the bad idea that he wants to be able to manage rooms via Outlook (exchange meeting requests), although our software already has a web-ui for this.

Problem is, apparently exchange needs a room mailbox for every room. So, if we currently have 20'000 rooms in the test-system, and 18'977 rooms in the prod-system, how can we automatically create rooms in exchange from the web-applicationvia EWS (if a new building is being requisitioned or if a room is cut into half) ?
(and also, in case 2 rooms are merged into one, how to remove rooms)

As far as I can tell, EWS doesn't support this use-case. What would be the best way to integrate this into a web-application ?

I presume other people must have had the same problem before me... Certainly, manually inputing every record can't be the solution, and neither can't a powershell-cmdlet...

Also, are there any hooks in exchange web services, like that when a room gets reserved or a reservation changes in outlook (hopefully not to a date where the room is already occupied), we can have exchange notifying the web-application ? OK, I admit, I just put in this last point as a joke, I already know that Outlook and Exchange are "incredibly well" engineered products ... :see_no_evil: :hear_no_evil: :speak_no_evil:

MichelZ commented 6 years ago

I think you have to resort to PowerShell. The good news is that you can use PowerShell from C# code...

ststeiger commented 6 years ago

@MichelZ: Wouldn't call that good news. And while it has to run in C#, it has to run on the web-server, not the exchange server...

MichelZ commented 6 years ago

What do you mean? I regularly use PS with Exchange from non-exchange servers.... all you need is the Exchange Management Shell installed on the Webserver

ststeiger commented 6 years ago

Ah, ok, well, in that case, it possibly works, but that still sucks.

MichelZ commented 6 years ago

Yes, a proper API would be nicer, this is definitely true. Maybe Exchange 2019 gets it, who knows :)

ststeiger commented 6 years ago

Wonder if Exchange Management Shell works on Linux with wine ;)

davster commented 6 years ago

EWS does not support management operations such as creating or deleting mailboxes. Remote powershell is likely your best option there.

ststeiger commented 6 years ago

Erm, thinking about it. Does it even work on Windows ?

Say I install Exchange Management Shell on the Webserver. But the webserver runs in one of our data-center servers, inside our datacenter-domain. The exchange installation runs in the client's domain, which is NOT in the datacenter. Does Exchange Management Shell work under this conditions ?

davster commented 6 years ago

O365 has a powershell virtual directory just like EWS or REST. In fact, even when running powershell from within the O365 server environment it is making "remote" powershell calls.

This may help:

https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/connect-to-exchange-online-powershell?view=exchange-ps