Updating/deleting calendar event without knowing owner - microsoft-graph-api

Is there a way, using the Graph API, to update/delete a calendar event without knowing who the event owner is? I see the api call to do these operations by including the owner of the meeting in the url path, but in my situation, another user may need to update/delete an event after the fact using the api, so we wouldn't know at that point who created it, unless I saved off the event owner for every event on my side. I am saving the event id on our side, but I don't know if I also need to save the user who created the event along with the id, in order to later update/delete the event. I am using application level access for the Graph API.
Or is there a way to look up the event owner, given the event id?

You'll need to know both the id and the "location" in order to delete an event. I say "location" because there are several places an event could potentially exist.
If the event lives within a user's default calendar you would need to know the userPrincipalName and the event id:
DELETE /users/{id | userPrincipalName}/events/{id}
If the event lives within a user's non-default calendar, you would need to know the userPrinipcalName, the calendar id and the event id:
DELETE /users/{id | userPrincipalName}/calendars/{id}/events/{id}
If the event lives within a group or team's calendar, you would need to know the group id and the event id:
DELETE /groups/{id}/events/{id}
One important thing to keep in mind is an event's id can change. You should also make sure you store the iCalUId. This is a persistent identifier that is you can use to validate you have the correct event or filter the /events list to find should the id you expect be missing.

Related

Microsoft Graph - Adding recurring event with exceptions

How can I add a recurring event with exceptions using the Microsoft Graph API?
Is this possible in Microsoft Graph at all?
Edit:
For instance, I want to create an event that will take place every Monday, starting 07/05/2021, but that will not occur on 07/12/2021.
I already know how to create the recurring event, but I don't know how to create it with this exception.
You first need to find the correct Event Instance you want to change.
/events/{id}/instances?startDateTime={dateTime}&endDateTime={dateTime}
This will return a list of instances within the specified date range. You then parse the list for the specific instance you want to obtain its unique id and delete it like any normal event.

Microsoft Graph - Is it possible to access all events in all calendars shared with me using one GET request?

I've figured out how I can loop through all the calendars I want to read and do separate GET requests to read the events in them, but is there a way to do this in one GET request? It seems like I need to provide either a user id or calendar id at some point in the url.

How can I duplicate a RailsEventStore event while maintaining meta-data

The scenario is that I have two ActiveModels: Invitation and Guest.
I've published a bunch of events to the event stream of an invitation and at some point that invitation is accepted and subsequently a guest is created. I would like to copy the events on the event stream of the invitation across to the event stream of the guest.
I've thought of duplicating using dup the original events, updating the stream field to be the guest's event stream but this will violate the unique constraint of the event_id field. So I would like the EventStore's publish mechanism to handle the persistence of the event.
I've thought of copying the data attribute of the original events across to new instances of the events and using publish but then I would get metadata (request_id, remote_ip, timestamp) on the event that does not reflect that of the original events which is important to keep for audibility.
Is there some technique to perform this kind of transfer / duplication of RailsEventStore events?
There is a technique — linking. In recent Rails Event Store releases (since v0.22.0) you're able to link an existing event to other streams: https://railseventstore.org/docs/link/. It retains the data and metadata.

Is there any way to handle native send of outlook appointment from add-in through Office.js?

To get Item Id in appointment compose mode i am using "saveAsync" in add-in the problem is with out user intervention the appointment item is saving to the MS Exchange.After discarding the opened appointment (by using office cancel "X" button) still the changes which i made while "saveAsync" execution are presented, it's not regaining the previous state.
I need to know is there any way to bring back the previous state of appointment if user click on discard ?
(OR)
Any way to handle the native send of outlook appointment from add-in through the office.js after "saveAsync" got applied ?
(OR)
Is there any other way of getting the Item Id of appointment in compose mode through the Office.js ?
Please,answer if you know how to handle any of these cases.
EDIT: Looks like at this time, it is not possible to revert to last saved version via the add-in, nor is there any way to get the itemId without saveAsync
Old Answer
If you are modifying an existing appointment, you can get the ItemID by calling Office.context.mailbox.item.itemId, however if you are creating a new appointment, you must call saveAsync in order for your appointment to be registered, and thereby given an ItemId.

How sync events on iOS with EventKit across multiple devices

Let's say I have to write an application that must sync with one of the calendars available on the device. Let's assume that I have "Action" objects that have a start date, end date, recurrence etc.
Device A: I create "Action" objects and then sync them using EventKit with my iCloud calendar named "Foo". I get some unique identifiers that I have to link them with my "Action" objects in order to know which one to update/delete in the future. Then I sync my "Action" objects with my own server.
Device B: I get the "Action" objects from the server. I modify them. I have to update the calendar items. What happens if I don't have the "Foo" calendar set on Device B? What happens if I do have it?
I guess I need to use the calendarItemExternalIdentifier and not the calendarItemIdentifier property in order to identify events uniquely across devices that use the same calendar, right?
Is that calendarItemExternalIdentifier given in the moment of creation of the calendarItem? or is it given by the iCloud server? Do I need internet connection for this to work?
The documentation for the calendarIdentifier property states:
A full sync with the calendar will lose this identifier. You should
have a plan for dealing with a calendar whose identifier is no longer
fetch-able by caching its other properties.
What does a full sync even mean?
calendarItemExternalIdentifier is available as soon as you save (with commit) a calendar item. But, there are situations when the calendarItemExternalIdentifier is later changed, when the calendar item is synced further to the server (e.g. if it's an event from an Exchange account).
All the other identifiers are not shared between devices (this includes identifiers for sources and calendars), so the best option is sticking with calendarItemExternalIdentifier.
A full sync with a calendar can occur when the user sets up a new source (e.g. the user removes and adds the same Exchange account). There may also be different situations that cause a full calendar sync.
calendarIdentifier is a local identifier, so it won't be of much use in your case (except if you want to create a workaround for the issue with calendarItemExternalIdentifier changing).
As mentioned earlier, the calendar and source identifiers are not global, so it would be near impossible to know if "Foo" calendar is setup on a different device, or if the "Foo" calendar is the same "Foo" calendar from your other device.
Usually, if you find your Action object on the new device, you can assume that the calendar that it belongs to is the same as the calendar from the different device.
One way to go about it, when updating your Action objects, would be to save the changes (as usual) to the server. Each of the devices (including the one that made the change) would then search for the corresponding calendar item, and update it if it's found.
I'm currently doing something similar, and this is probably what I'll end up doing.
A better alternative (probably more time consuming as well) would be to have the server connect and sync with the external sources (CalDav, Exchange etc.).

Resources