Edit Google Calendar "From" and "Organizer" - go

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.

Related

Receiving Change Notifications From another user's Calendar

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

Outlook - Copy group calendar events to user outlook calendar

We have a recurring event setup in Office 365 group calendar. If a new member is added to this group, that member can see the event in "Group" calendar and in order to see this event in main calendar, user have to click on "Copy to My calendar" in group event.
Is there any way to do this via code/script? Basically achieve "Copy to My calendar" for Office 365 group calendar to User's main calendar via code.
I'm not sure when you click "Copy to my calendar" if it has some smart link or if it is just a copy at a point in time.
You could subscribe to the calendar using a webhook. That webhook would call your API hosted somewhere (an Azure Function, a web api hosted on Azure App Service). Your API would recieve the event id, it could then fetch the full details of the event and then create a new event on the users calendar.
I'm assuming that you'd want this to create it on all users calendar and also to update it if there were changes on the source event.
Its complex for sure doing it this way.
https://learn.microsoft.com/en-us/graph/webhooks
https://learn.microsoft.com/en-us/graph/api/resources/event?view=graph-rest-1.0

How to set label for Hangouts Meeting via API

Background
I'm trying to create an appointment calendar using GSuite and Google Calendar API. When a user (no Google account and outside the GSuite organization) creates an appointment, I'm trying to create a Calendar event on the Calendar of an organization member via the Google Calendar API and generate a Hangouts meeting link.
Problem
I can create the event and the Hangouts meeting link, but I cannot create a custom label for the video link. I was able to make it slightly unique by adding an attendee with a fake email xczczf#example.com to John Doe's calendar to get a label of doe-j-xcz, but I would like full control over the label if possible.
Attempted Solutions That Didn't Work
Create the event and provide a conferenceData.createRequest and an entryPoint with the desired label.
Create the event first and then send a patch with the information described in 1
Changing the conferenceId
After messing around with the API Explorer, a custom label can be made by:
Creating the Cal event and adding a meeting link using a createRequest
Send a Patch with conferenceData.conferenceId set to the unique label value

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.

Programmatically adding attendees to calendar event on macOS

Our requirement was to add an invitee to an EKEvent.
As written in the Apple EventKit documentation it is not allowed to add meeting invitees programmatically since those properties of an EKEvent are read-only.
We tried another way to create an .ics file and add it the calendar programtically. But with this approach we are not able to create attendees to an event hosted in an Exchange account. Where as other accounts like GMail are working fine.

Resources