EWS Synchronization optimization - exchange-server

I have an EWS synchronizer for all employees in office which runs automatically every hour or so, and updates all calendars, even if no change/update has happened. Is there any way through the API to make methods/functions that checks if it can register any changes in their calendar, and only update the ones that it registered had changes?

Have you looked into Push or Streaming Notifications?

Related

How should I load historical events from another service?

I have a User Microservice, that publishes events when a user is created, modified, or deleted. In addition, I have a Calendar Microservice that needs the user data. The Calendar service, subscribes to the user events and keeps a read only copy of the needed data.
I have just added an Account Microservice that needs the existing user data and I have used the same model as above. What is the best way to get the existing user data into the Account Microservice?
When I did the first Microservice I republished the user-modified event for every user. It was simple, because nothing else was using this event. If I republish now, for the new Account Microservice, the existing Calendar Microservice will also get the events. My logic is idempotent, but this is a lot of wasted work and will only get worse as I get more services.
I've loaded data a lot in the past. I know how to make it work, but I am looking for a best-practice and a way to do it with minimal coordination and dependencies with other services.
When I did the first Microservice I republished the user-modified event for every user. It was simple, because nothing else was using this event. If I republish now, for the new Account Microservice, the existing Calendar Microservice will also get the events. My logic is idempotent, but this is a lot of wasted work and will only get worse as I get more services.
What you probably want here is a design in which you pull, rather than push, copies of the events to new systems: see Greg Young, Polyglot Data.
In broad strokes - the subscriber keeps track of the high water mark, and asks for more events after some mark, and then the event store answers that query with zero or more new events, in order. The twitter timeline api can give you a sense for how that might work -- sadly, the images that explained the ideas seem to have been removed from the docs, but some of them have been captured here at stack overflow, and by the wayback machine

Integrating a multi-calendar solution with Microsoft Exchange/Outlook

I have built a platform that in essence allows users:
to create a company profile and invite your colleagues,
create an office with a floor plan,
add tables and meeting rooms to the floor plan with each meeting room having a separate calendar,
book tables and meetings in meeting rooms.
The platform is built on Python/Django.
Now I am trying to implement a sync mechanism that would work with Office 365 and local Exchange distributions. The sync would be two way, that means an event created in Outlook would trigger an event to be created in our system and vice versa.
My first attempt was to use the EWS SOAP API (with exchangelib). But soon I've run into problems when figuring out how to create triggers for Outlook events. This ended in failure as synchronization would involve constant bombing of slow API-calls such as iterating through accounts and checking if anything changed in their calendars.
Second attempt involved using the Microsoft Graph API that has this neat push notification feature that would solve polling (or so I thought). But as I later found out, having the administrator link his privileged Exchange account and then being able to subscribe event changes for all associated accounts in one go was not possible (thanks to this article). So again this lead to the realization that polling (or making everyone link their personal accounts) was the only way to go.
What approach would you recommend to achieve two-way sync with Exchange that would involve only having the admin do the account linking with as little overhead and polling as possible?
Is there anyone who have developed large-scale applications that do something similar? If so, can you push me in the right direction?
A bit late to the game here, but maybe what you want is the EWS SubscribeToPushNotifications service. It's not implemented in exchangelib yet, but there's a ticket for it https://github.com/ecederstrand/exchangelib/issues/145
Implementing the basics should not be difficult.

Google calendar api - How to avoid double booking?

Is there a way to avoid race conditions when inserting events into Google Calendar using the API? I have an experimental app that needs to insert events into user's calendar. However, the user should not be double booked at a particular time.
The only true way of guaranteeing something like this is if Google provides a way. Other solutions are prone to race conditions (example, some other app that the user has updating it while my app is ignorant). The options as far as I can tell:
E-Tags with If-Match option - But this option is not valid for inserts according to the docs (https://developers.google.com/google-apps/calendar/v3/version-resources).
Important: There is no support for conditional modifications for
insert operations. Instead, it is guaranteed that if you are allowed
to provide a resource ID, then the operation will only succeed if no
existing entry has that ID.
So if I provide an if-match with the calendar etag and try to insert, it always fails regardless of the fact that the etag is correct.
Using "watch" for a brief period while the event is about to be inserted (https://developers.google.com/google-apps/calendar/v3/reference/events/watch). However, this solution is prone to race conditions due to the time take to get notified. One user inserting while my app gets notified of the update is problematic.
Sync the whole calendar with server periodically and consider the source of truth as the synced version and avoid double booking. Less optimal because new events added won't get synced fast enough, but the most likely will work.
What other solutions come to mind? I think #3 is the most suitable to guarantee consistency and integrity of data to avoid double booking.
I found a solution to this on this blog which states that you'll be using Calendar Resource API instead of the Google Calendar. I think this guide is what you're looking for.
Unlike a regular calendar, resources:
-Do not allow conflicts
-Can be shared across everyone on your Google Apps domain
-Can be invited (multiple at a time) to events, just like a person
-Their ability to share availability with everyone makes resources great for managing rooms schedules. Especially in a shared work
environment like your office.
FYI: This guide assumes you already have Google Apps. Currently only
paid accounts have access to resource calendars. If you’re
grandfathered in or using a personal Gmail account, this process won’t
make much sense.

Webhooks with Microsoft Dynamics CRM?

We have started to use Microsoft CRM for all our client information however we would like to have the most up to date information from CRM for internal tools.
The way we could do this is by running a tool that looks at the data every x minutes and keeps all updated records in the database.
Could someone give a explination on how we could use webhooks for this and if it actually is possible. This would be a lot more efficient to be notified when there is a change rather than checking all the time.
I have researched and found a few projects but they were all in beta - invite only or not available.
In Dynamics CRM Webhooks are not available as intended in the normal definition.
But you can use plugins to implement your notifications. From MSDN:
https://msdn.microsoft.com/en-us/library/gg328490.aspx
Another way to think about plug-ins is that they are handlers for
events fired by Microsoft Dynamics CRM. You can subscribe, or
register, a plug-in to a known set of events to have your code run
when the event occurs.

Exchange Server Global Events

I'm looking to mirror contacts added to exchange in a separate system. I'd like to do this as contacts are added if possible.
I've seen some listeners available in the API I can use, but those look like they're on a user basis. To use them I think I'd have to have an instance open for every user and I believe they also only remain open for 30 minutes.
Is there anyway to get a notification whenever any user adds a contact to exchange?
No there is no such thing as global events in Exchange (not since 2007 anyway) the closest would be Transport agents but these are only useful for items that are traversing the Transport Pipeline. The application your developing will need to deal with things on a Mailbox by Mailbox basis.
Cheers
Glen

Resources