Ramesh Nagarajan
Ramesh Nagarajan

Reputation: 11

How to enable canAddAttachments capability for Google Calendar Workplace Add On

I’m creating an add on that adds attachments to an event (think one click button to generate meeting notes and then add that newly created doc to the event as an attachment).

I’m using the example shown here Add attachments with a callback function.

I have the OAUTH scopes setup correctly (fixed an error that complained about that), but adding an attachment fails with this message:

An add-on cannot add attachments when canAddAttachments capability is false.

I’m not sure how to set this capability. This is on a standard Gmail account calendar, not a workspace account.

Thanks

Upvotes: 0

Views: 143

Answers (2)

David D.
David D.

Reputation: 567

This seems to be possible only part of the file attachment flow (when user clicks attach button). Programmatically attaching from an eventOpenTrigger function doesn't work and will return the error:

"An add-on cannot add attachments when canAddAttachments capability is false."

In order to make it work create the callback function as described in this Google Doc

And make sure you have these 2 in your oauthScope:

"https://www.googleapis.com/auth/calendar.addons.current.event.read",
"https://www.googleapis.com/auth/calendar.addons.current.event.write"

As well as this in calendar events:

"currentEventAccess": "READ_WRITE",

Upvotes: 0

Reuben Kan
Reuben Kan

Reputation: 1

From the comment in the sample code, only the event in eventAttachmentTrigger can add an attachment.

/**

  • Build a simple card with a button that creates a new attachment.
  • This function is called as part of the eventAttachmentTrigger that
  • builds a UI when the user goes through the add-attachments flow.
  • @param e The event object passed to eventAttachmentTrigger function.
  • @return {Card} */

Upvotes: 0

Related Questions