Receiving Change Notifications From another user's Calendar - outlook

ENVIORNMENT
Outlook Desktop (Office 365);
Exchange Server;
Azure Cloud
INITIAL CONDITIONS
USER_A is USER_B's assistant and manages USER_B's calendar (Outlook Shared Calendar). We would like to track the changes in USER_B's calendar. In Outlook/Exchange speak, USER_A is a delegate of USER_B.
GOAL
When certain Outlook Calendar Items are modified, we'd like to call a Function App which will update a database. The calendar could be a Shared Calendar, but not necessarily a shared Calendar.
USE CASE
USER_B is not logged in, but USER_A creates an appointment in USER_B's calendar.
Even though USER_B is not logged in, we'd like to capture the change made by USER_A and update our database. In other words, a change notification should fire for the shared calendar, even though the owner of that calendar is not logged in.
QUESTION
Does the Function App need "App" level permissions to do this?
Would the code look something like:
POST https://graph.microsoft.com/v1.0/subscriptions
Content-type: application/json
{
"changeType": "created",
"notificationUrl": "https://webhook.azurewebsites.net/api/send/UpdateDataBase",
"resource": "users/{a-user-id}/events",
"expirationDateTime":"2020-10-20T19:23:45.9376913Z",
"clientState": "bigSecret",
"latestSupportedTlsVersion": "v3"
}

In order to get change notification in shared calendars, "Application" level permissions are required.
I found this here How to subscribe calendar event if calendar is given delegated permission using ms-graph api

Related

Organizer does not receive email notification when attendee declines the event

We use a service account to authenticate google calendar and programmatically create calendars and appointment events. However, when a customer declines an event, there's no notification whatsoever of the decline and we cannot find any email regarding the decline in the admin or organizer's email inbox. is it because the service account is a dummy user? How can we get the organizer to be tied to an actual email account so people can get notification of the response status of the attendee?
We tried
create the calendar and event programmatically, attendee declines, no notification (despite setSendNotification("all") in the API call)
create the calendar and event programmatically, move the organizer to a different calendar (new organizer), attendee declines, no notification for the new organizer (despite setSendNotification("all") in the API call)
update code
googleAPIHelper.executeWithThrottling(service.events().update(calendarId, remoteEvent.getId(), remoteEvent).setSendUpdates("all"), Event.class);
insert code
googleAPIHelper.executeWithThrottling(service.events().insert(calendarId, eventToInsert).setSendUpdates("all"), Event.class);
move organizer code
googleAPIHelper.executeWithThrottling(service.events().move(calendarId, remoteEvent.getId(), destinationCalendarId), Event.class);
As it turned out, for each calendar the organizer owns (found in "Other Calendars"), we have to toggle the "Other notifications" settings to receive an email (i.e. Event responses). The default is set to "None."
E.g.
See also: https://www.youtube.com/watch?v=wgbpsm82AaY

Edit Google Calendar "From" and "Organizer"

I want to create event via google calendar api using Go. I found out that the sender (From) is whoever responsible in client_id I provide in the google API, in this case me. Can I edit this sender, so that it is not sent from me? At least I can edit the display name of the sender, the email I think will always be my email
Also about editing the organizer, I tried to use move action but it only moves the event, not change the organizer. Is there other way to edit organizer?
To address your questions:
1. Can I create an event from another address?
What you want can be done by creating a service account and performing domain-wide-delegation
What is a service account?
A service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs - in your situation the Calendar API.
After creating the above mentioned service account, you will have to perform domain-wide-delegation and impersonate a user in your domain in order to be able to create the event wanted.
Now, when writing the code for your application, you will have the use the credentials that were created for this account in order to authorize the requests.
OR
If you want to specifically edit only the display name of the creator of the event, you can perform an update request:
PUT https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
And add in the request body this:
"creator": {
"displayName": "UPDATED DISPLAY NAME"
}
2. Can I edit the organizer?
According to the Calendar API Documentation:
organizer > The organizer of the event. If the organizer is also an attendee, this is indicated with a separate entry in attendees with the organizer field set to True. To change the organizer, use the move operation. Read-only, except when importing an event.
Therefore, the organizer can be changed/updated only when importing the event in question.
Reference
Authorizing Requests to the Google Calendar API
;
Creating A Service Account;
Calendar API Events Resource;
Calendar API Events:Update.

Send calendar event invitations on behalf of a user with Microsoft Graph

I have a web app that allows receptionists to create calendar events on Outlook/Office365. To manage the events I use Microsoft Graph. The app sends the Graph requests under his own identity, because I need it to have no user interaction for logging in, so it uses Client_ID and Client_Secret with administrator rights to do everything. I can create events on the calendars of any user in the organization, which kinda works like creating an event "On behalf of", but there's a problem. When you create an event in someone else's calendar, Outlook will send the invitations as the calendar's owner, and this means that if the owner doesn't have permission to send messages to a mailbox (for example, a room mailbox), the invitation will never arrive. I need it to send the invitations from another user account (the receptionist that creates the event), like Office 365 does when you create an event on a shared calendar. Is that possible? Or is there any workaround to accomplish what I need?

Exchange EWS ErrorCalendarIsNotOrganizer despite being the organizer

I'm trying to cancel a meeting I created by using an EWS XML CreateItem request (against a 2013 server):
<ns2:CreateItem MessageDisposition="SendAndSaveCopy"><ns2:Items>
<ns1:CancelCalendarItem>
<ns1:ReferenceItemId Id="AAMkA...." ChangeKey="DwAAA..."/>
</ns1:CancelCalendarItem>
</ns2:Items></ns2:CreateItem>
So far so good, however Outlook denies me access with the ResponseCode "ErrorCalendarIsNotOrganizer" / "User must be an organizer for CancelCalendarItem action".
A look in the event detail by using GetItem with BaseShape=ALL_PROPERTIES reveals that the account I use is set as Organizer, however at the same time:
the IsOrganizer field is set to false
in EffectiveRights the fields Read, Modify and Delete are true.
I can delete the appointment lateron using a DeleteItem request and it works, however it only removes the appointment from the room's calendar but not from the mailboxes of the attendees.
What causes this? There is no impersonation in use, only the service account I use has delegation access to every room mailbox (to be able to see all appointments).
I can delete the appointment lateron using a DeleteItem request and it works, however it only removes the appointment from the room's calendar but not from the mailboxes of the attendees.
It sounds like your accessing the appointment in the Room Mailboxes calendar ? this is why even if your using the account that is the organizer of that appointment the isOrganizer will return as false because this property is only true on the copy of the Appointment in the Organizers calendar. To correctly cancel the meeting you need to do that on the calendar of the Organizer (not the rooms or any attendee instance of the meeting). This will still only delete the appointment in the organizer calendar and send cancellation messages to the attendees.
An important point is that all instances of the meeting stored in the Attendees and Meeting Room calendars are separate Exchange Store items with no direct link. So deleting the organizer instance (or any attendee instance) has no affect on the other attendees instances these must be processed separately by the attendees themselves based on the cancellation message that is received.

Attendee not getting meeting invite on creating event using service account, google calendar API

Hi I am creating an event using service account and added attendees. The response returned correctly but attendees are not getting invite mails. The Service account is not linked (shared) with any google account. Though to login into API console I used my gmail account. Calendar Id was given as Primary. Where the event will get created, on Service account's Calendar or my primary Calendar?. I could not see it on mine Calendar but response returned with Status "Confirmed". I am more interested in invites rather where the original event got created.
Any help would be appreciated !!!
You need to remember that a service account is not you. Think of a service account as a dummy user. It has its own calendar account, drive account and probably a bunch more. When you inserted an event into primary you inserted it into the service accounts primary calendar.
You have a few options.
Share your primary calendar with the service account. Just add it as a user. Find the calendar id in the settings and have the service account insert into that calendar id.
Have the service account share its primary calendar with you by granting you permissions to it. you should then be able to see it on the bottom left hand side of the Google calendar website.
Have the service account invite you to the event on the service accounts Google calendar.
Have the service account create the event with you as an attendee event.insert check the body of the request.

Resources