Calendar Event sendNotifications inconsistency when attendee is a secondary calendar - google-api

I am creating and updating events using a service account and there appears to be an inconsistency between how notifications are handled depending on whether the attendee email is a primary or secondary calendar.
In the following example all calendars are set to receive invite and event change notifications by email.
Joe Smith has a primary calendar j.smith#gmail.com
Sam Stove has a secondary calendar xxx#group.calendar.google.com
Event inserted with Joe and Sam as attendee's (sendNotifications => false).
Joe does not receive a notification (as intended), Sam does. To reiterate Joe and Sam have identical notification settings on their calendars. With sendNotifications => true both receive a notification (as expected).
I am using the PHP API client 2.1 but I tried with 1.x as well and the outcome is the same. Since sendNotifications is a simple GET parameter I tend to think this is an API issue rather than a client issue.

As mentioned in Notifications,
To send email notifications to attendees for events that were inserted or updated via the API, set the sendNotifications parameter in the insert/update request to true.
And, do also note that:
For attendees with non-Google email addresses, these notification emails are the only way they can find out about the event: it won't be added to their calendars automatically.
This additional references might also help:
Registering your domain
Verifying domains for push notifications

Related

Send Google Calendar events with different descriptions

I need to create a google calendar event using the Google API:
Each attendee should receive a different content in the description of the invite. Is there a way to pass description on attendee?
Answer:
It is not possible to do this.
More Information:
The information about an event is tied to the event itself in Google Calendar, rather than to the invite that is sent to the attendees. The invitation will have information contained within it about the event that it is related to. There is only one description, and so this same description will be sent to all attendees in the invitation.

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.

Google Calendar Java API stopped sending invitation to attendees

I have a gserviceaccount for my application that sends invitations to some Google Calendar events, so I use Java API for that (class com.google.api.services.calendar.Calendar, to be precise). It worked like a charm for more than year, but now I'm having some troubles with that as it just stopped working. I still can create new events via API and invite participants, later I can see they are saved properly (when getting this event from API, I can see the participants' emails), but the participants do not receive any emails or other kinds of invitation (they are not aware of the event at all)
I have already tried to delete and invite atteendees and events programatically, but nothing happened. When I create an event using normal Calendar app and then invite to this event (using app, not API), I get the invitation properly.
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.EventAttendee;
Event event = service.events().get(CALENDAR_ID, columnDay.getGoogleCalendarEvent().getGoogleEventId()).execute();
event.getAttendees().add(new EventAttendee().setEmail("foo#example.com"));
service.events().update(CALENDAR_ID, event.getId(), event).setSendNotifications(Boolean.TRUE).execute();
I expect the attendee to be saved and an email to be sent, but only a attendee is saved and I can't see any sort of invitation (email or anything). I don't get any errors.

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