Create Microsoft Graph Api Subscription for accept/reject meeting event by attendees - microsoft-graph-api

In my project, I have created Rest API project to create subscription and to listen notification from Microsoft Graph API.
I want subscription for following things:
When I create meeting room event then I want to get notification if any attendees accept/reject that meeting room event.
If whole meeting event is cancelled or moves to another time slot or added any new attendees.
I was expecting all above gets covered by following code but it is not :
var subscription = new Subscription
{
ChangeType = "updated,deleted",
NotificationUrl = $"{_notificationHost}/listen",
Resource = "me/events",
ClientState = Guid.NewGuid().ToString(),
IncludeResourceData = false,
// Subscription only lasts for one hour
ExpirationDateTime = DateTimeOffset.UtcNow.AddHours(1)
};
It does not send notification when accept or reject done by attendee with 'Do not send a response'. How I can get notification for this?

I managed both scenarios :
I am getting notification for attendees's reject/approve response on my listen api : NotificationUrl = $"{_notificationHost}/listen",
If new attendess added/removed or meeting time change or meeting cancelled then also we can get notification in Listen api.

Related

How to create subscription for specific event of Graph API

I want to get notifications on a specific event that I have created from my application. For that, I am using the below code to subscribe to a specific event.
var subscription = new Subscription
{
ChangeType = "updated,deleted",
NotificationUrl = $"{_notificationHost}/listen",
Resource = "me/events/{event-id}",
ClientState = Guid.NewGuid().ToString(),
IncludeResourceData = false,
// Subscription only lasts for one hour
ExpirationDateTime = DateTimeOffset.UtcNow.AddHours(1)
};
But while creating it throws an exception:
Error creating subscription: Code: ExtensionError Message: Operation:
Create; Exception: [Status Code: BadRequest; Reason: The value
'https://outlook.office365.com/api/beta/Users('{userid}')/Events('{event-id}')'
of parameter 'Resource' is not supported.]
Just ran into this same issue. It looks like the Subscription API doesn't support subscriptions on specific events, only the entire calendar. There's an example for subscriptions to events in the "Resources examples" section, which looks like exactly what you want: me/events. The ID of the updated/deleted event is included in the callback, so if you only care about certain events, you can use that.

Muting Email Notifications related to Attendee Responses in Google Calendar API

I added the feature of syncing google calendar with events of my application. But the issue was, the event organizer/creator was receiving emails from google whenever the event attendee responds to the google calendar event. I wanted to receive the email notification for only creation/updation of events. I added the notification_settings and kept event_response method to blank but it didn't work.
CALENDAR_ID = 'primary'
CALENDAR_NOTIFIER = 'externalOnly'
gcal_event = client.insert_event(
CALENDAR_ID,
Google::Apis::CalendarV3::Event.new(gcal_event_params(gcal_event_attendees)),
send_updates: CALENDAR_NOTIFIER
)
-----------------------
// added notification_settings later so that the organizer should not receive event response, but no luck so far.
def gcal_event_params(gcal_event_attendees)
{
summary: event.name,
description: event.description,
location: event.location,
start: { date_time: event.start.to_datetime.to_s, time_zone: org_timezone },
end: { date_time: event.ends.to_datetime.to_s, time_zone: org_timezone },
attendees: gcal_event_attendees,
reminders: { use_default: true },
notification_settings: {
notifications: [
{type: 'event_creation', method: 'email'},
{type: 'event_change', method: 'email'},
{type: 'event_cancellation', method: 'email'},
{type: 'event_response', method: ''}
]
} }
end
Answer:
The notification settings for event creation, change, cancellation and response are settings of the Calendar itself, not the individual events of the Calendar. The notification_settings parameter of Events: insert does not exist, which is why this is not working.
More Information:
I'm not really sure where the writer of the blog that you linked is getting the information, but the Events: insert method of the Calendar API does not have this parameter.
In the user interface at calendar.google.com, you can see the notification settings you are referring to in the settings page for the whole calendar, not for individual events:
For individual events, when the event is created, you can use the sendUpdates parameter to specify who, if anyone, should be notified when the event is created. The same parameter exists as a part of the Events: update method, which lets you set who gets notified of that specific change.
If you want to have notifications set up for the creation, changing and cancellation of events, but not of event responses, then this needs to be set up for the Calendar itself. Unfortunately however, this isn't something that can be done with the API and needs to be set in the User Interface itself.
This does unfortunately mean that what you're looking at doing isn't something that is possible through the Calendar API.
Feature Request:
If this is of interest to you, you can however let Google know that this is a feature that is important for the Calendar API and that you would like to request they implement it. Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services. The page to file a Feature Request for the Calendar API is here.
References:
Google Calendar API - Events: insert
Google Calendar API - Events: insert Parameters
Google Calendar API - Events: update
Google Calendar User Inferface
Google Calendar API - Calendars: insert
Google Calendar API - Calendars: update
Google Issue Tracker - Create a Calendar API Feature Request

SingleValueExtendedProperty is propagated only when room accept the event

I'm doing some code that book meeting rooms integrated with Outlook Office 365.
I'm using Microsoft Graph to do that and my solution requires some extended properties that are used in many functionalities.
My problem is:
When I update the extended properties of some event in the owner's calendar, the change doesn't propagate to the room copy of the event. The extended property is propagated only when the room needs to accept the event again (e.g. start date changes).
Piece of code I'm using to update event:
Event toUpdate = new Event
{
Id = eventData.EventId,
SingleValueExtendedProperties = new EventSingleValueExtendedPropertiesCollectionPage()
{
new SingleValueLegacyExtendedProperty
{
Id = "String {00020329-0000-0000-c000-000000000046} Name SkipBookingCancellation",
Value = "True"
},
}
};
await calendarService
.Users[calendar.Email]
.Calendar
.Events[toUpdate.Id]
.Request()
.UpdateAsync(toUpdate);
It's kinda strange because when I create the event in the owner's calendar, it is propagated through rooms correctly, but when I update the extended property, it works on the original event but it doesn't affect the room's copy (unless the room needs to accept the event again).
Perhaps Graph is missing that old functionality of EWS that informs to the update method to force sending the invitations again, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy.

Youtube API - Allows Subscribe User but takes away next day

we have a product that will subscribe a user to another user(s) after they go through and give us full permission to do so. The user is then subscribed to these other user(s) ... you can see this in youtube after the API is performed (seems successful) ... but a day later the subscribers are removed and gone? This always worked well. Anyone experience similar issues or know the why here?
When using the API with full permission scope, we Subscribe the user to a channel and we get varying results :
the Google_Service_YouTube_Subscription_Object is returned with valid data
The channel Subscription https://www.youtube.com/subscribers?ar=2&o=U may or may not increase in value (counter at top)
The channel Subscriber list https://www.youtube.com/subscribers?ar=2&o=U is not showing the new user (subscriber)
The user shows in their Youtube view that they are subscribed to the Channel
the user Comment on the video is displayed depending on the user privacy settings
the user Like on the video is counted
the NEXT day: comments, subscriber counts are removed from the Channel, likes on the video seems to stay
$youtube_client = new \Google_Client();
$youtube_client->setClientId(xxxx);
$youtube_client->setClientSecret(xxxx);
$youtube_client->setScopes(xxxx);
$youtube_client->setRedirectUri(xxxx);
$youtube = new \Google_Service_YouTube($youtube_client);
$resourceIdyt = new \Google_Service_YouTube_ResourceId();
$resourceIdyt->setChannelId($channel);
$resourceIdyt->setKind('youtube#channel');
$subscriptionSnippetyt = new \Google_Service_YouTube_SubscriptionSnippet();
$subscriptionSnippetyt->setResourceId($resourceIdyt);
$subscriptionyt = new \Google_Service_YouTube_Subscription();
$subscriptionyt->setSnippet($subscriptionSnippetyt);
$subscriptionResponse = $youtube->subscriptions->insert('id,snippet', $subscriptionyt, array());

Microsoft Graph APi not returning "Cancelled" Events

I am trying to get all the events in a Conference room's calendar with Microsoft graph API, given a startDateTime and endDateTime. I tried the following API's -
1. https://graph.microsoft.com/v1.0/users/{id}/events?startDateTime=2017-03-20T05:00:00.0000000&endDateTime=2017-04-06T21:00:00.0000000
2.https://graph.microsoft.com/v1.0/users/{id}/calendar/calendarView?startDateTime=2017-03-20T05:00:00.0000000&endDateTime=2017-04-06T21:00:00.0000000
The response includes all events with isCancelled=false. How do I fetch events which were Cancelled?
&$filter=isCancelled%20eq%20true also returned empty as there are no events with isCancelled=true in response
By design, when an event is canceled, it is deleted from the calendar. So, there isn't a way today to query list of events that are deleted. We have an item in our backlog for supporting deleted events, but no timeline.
I just tried
https://graph.microsoft.com/v1.0/Users/xx/Calendar/Events/xx/instances
?startDateTime=2020-02-17&endDateTime=2020-03-01&isCancelled=true
and what came back are all the non-cancelled events...
Ditto isCancelled=false
leaving off the &isCancelled=xx parameter returns all the events with the isCancelled attribute set to false for everything.
I was trying to fetch event after getting notification when event cancelled. I am trying with notification resource url and it throws exception:
Microsoft.Graph.ServiceException: Code: ErrorItemNotFound.
What I was expecting that response with notfound status code rather than throwing exception.
My code for fetching event:
var request = new EventRequest(
$"{_graphClient.BaseUrl}/{notification.Resource}",
graphClientApp,
null);
var message = await request.GetResponseAsync();
var response = await message.GetResponseObjectAsync();

Resources