Hi,
Back in June we added a new action type - Manage Exchange. It is designed to support various operations that you can perform in Exchange from SharePoint. The first such action type was Create event. It allows you to create Exchange events based on SharePoint list item properties. Additional capabilities were supposed to be added in the future.
Well, the future is here now. Today we are adding two new operations to the action:
- Update event - updates existing Exchange events with new information
- Delete event - deletes Exchange events
As with Create event, you can work with events in your own calendar, or, if you are a site collection admin, in other users' calendars as well. We provide support for multiple event properties, including attendees and All Day events.
To demonstrate how the action works, I'm going to build a simple but complete real-world system. We are going to implement a one-way sync between a SharePoint calendar list and an Exchange calendar, so that events added to the list are added to Exchange (or updated and deleted as needed), basically any change in SharePoint is automatically mirrored in Exchange.
We are going to be using 4 actions for it: 3 Manage Exchange actions and one Update list item action. But first, we need to make a small change in our SharePoint calendar list. We will create two new columns, that will help us perform the update in Exchange:
- Original Title (single line of text) - to store the title of the event prior to user changes. As we are using event's title and start time as a unique identifier for the matching event in Exchange, we need to know what the title was before it was changed by the user, so we can find the event in Exchange (where it still has the old title) and update it.
- Original Start Time (date and time) - same idea as Original Title.
These are the actions we are going to be creating:
Now lets add them.
NOTE: in Office 365, you must be a Global Administator to add the first such action in your tenant. Subsequent actions do not require you to be an admin. This is needed to grant access to Exchange so the app can create and update events there. The grant request pop-up will appear every time you save a Manage Exchange action, but it can be ignored when the consent was already granted in the past, it will still work.
- New event - runs on New and creates a new event in Exchange.
- General Settings
- Action Settings
- General Settings
- Update event - for existing events, updates the event in Exchange with new values from SharePoint
- General Settings
- Action Settings
- General Settings
- Delete event - deletes event from Exchange when it's deleted from SharePoint
- General Settings
- Action Settings
- General Settings
- Store original values - the only action that does not interact with Exchange. It is used to update our Original Title and Original Start Time columns, so they are ready for the next update. As this action happens after the Update event action, we might have two different titles when updating the event in Exchange: the original title (the one that the event in Exchange still has) and the new title that was updated in SharePoint. This action runs on New and Edit events. We are also going to be using Conditions to only run the action when Title or Start Time actually change.
- Action Settings
- Conditions
Notice how "after change" condition is used. It compares the current value of Title with itself (which is always true) and it also compare the previous value of Title with the current value using the reverse operator (not equals in this case). So it will only be true when the value actually changed, otherwise the previous value will be the same as the current value.
- Action Settings
And this is it, now any change made to the events in SharePoint will be reflected in the Exchange events!
The feature is already added to Office 365 and will be added to the on-premises version soon.