microsoft.outlook.calendar
Module microsoft.outlook.calendar
API
Declarations
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_microsoft.outlook.calendar_2.1.0.png)
ballerinax/microsoft.outlook.calendar Ballerina library
Overview
Ballerina connector for Microsoft Outlook Calendar is connecting the Calendar API in Microsoft Graph via Ballerina language easily. It provides the capability to perform CRUD (Create, Read, Update, and Delete) operations on Event
& Calendar
stored in Microsoft OneDrive.
This module supports the Microsoft Outlook Calendar API version 1.0.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create a Microsoft Outlook Account
- Obtain tokens
- Follow this link client ID, client secret, and refresh token.
Quickstart
To use the outlook calendar connector in your Ballerina application, update the .bal file as follows:
Step 1: Import MS Outlook Calendar Package
import the ballerinax/microsoft.outlook.calendar module into the Ballerina project.
import ballerinax/microsoft.outlook.calendar;
Step 2: Configure the connection to an existing Azure AD app
You can now make the connection configuration using the OAuth2 refresh token grant config.
calendar:ConnectionConfig configuration = { auth: { refreshUrl: <REFRESH_URL>, refreshToken : <REFRESH_TOKEN>, clientId : <CLIENT_ID>, clientSecret : <CLIENT_SECRET> } }; calendar:Client calendarClient = check new(configuration);
Step 3: Invoke connector operation
- Now you can use the operations available within the connector. Note that they are in the form of remote operations. Following is an example on how to create a calendar using the connector.
public function main() returns error? { calendar:EventMetadata eventMetadata = { subject: "Test-Subject", body : { content: "Test-Body" }, 'start: { dateTime: "2021-07-16T12:00:00", timeZone: calendar:TIMEZONE_LK }, end: { dateTime: "2021-07-16T14:00:00", timeZone: calendar:TIMEZONE_LK }, location:{ displayName:"Harry's Bar" }, attendees: [{ emailAddress: { address:"samanthab@contoso.onmicrosoft.com", name: "Samantha Booth" }, 'type: calendar:ATTENDEE_TYPE_REQUIRED, status: { response : calendar:RESPONSE_NOT_RESPONDED } }], allowNewTimeProposals: true }; calendar:Event|error generatedEvent = calendarClient->createEvent(eventMetadata); log:printInfo(generatedEvent.toString()); }
- Use
bal run
command to compile and run the Ballerina program.
Clients![](/images/permalink.svg)
microsoft.outlook.calendar: Client![](/images/permalink.svg)
Ballerina Microsoft Outlook Calendar connector provides the capability to access MS Outlook Calendar API. This connector provides the capability to easily create appointments & events, organize meetings, manage user's calendar etc.
Constructor![](/images/permalink.svg)
Initializes the connector. During initialization you can pass either http:BearerTokenConfig if you have a bearer token or http:OAuth2RefreshTokenGrantConfig if you have Oauth tokens. Create a Microsoft account and obtain tokens following this guide.
init (ConnectionConfig config)
- config ConnectionConfig - Configuration for the connector
getEvent![](/images/permalink.svg)
function getEvent(string eventId, TimeZone? timeZone, ContentType? contentType, string? queryParams) returns Event|error
############################################################################# Operations on a Event resource The Event resource is the top-level object representing a event in outlook. ############################################################################# Get event by proving the ID Get the properties and relationships of the specified event object. API doc : https://docs.microsoft.com/en-us/graph/api/event-get
Parameters
- eventId string - ID of an event. Read-only.
- timeZone TimeZone? (default ()) - Preferred Time Zone of the start and end time. (Default :
UTC
)
- contentType ContentType? (default ()) - Preferred Content-Type of the body. Values :
text
ortext
(Default :html
)
- queryParams string? (default ()) - Optional query parameters. This method support OData query parameters to customize the response.
It should be an array of type
string
in the format<QUERY_PARAMETER_NAME>=<PARAMETER_VALUE>
Note: For more information about query parameters, refer here: https://docs.microsoft.com/en-us/graph/query-parameters
listEvents![](/images/permalink.svg)
function listEvents(TimeZone? timeZone, ContentType? contentType, string? queryParams) returns stream<Event, error?>|error
Get list of events Get the properties and relationships of all event objects as a array. API doc : https://docs.microsoft.com/en-us/graph/api/user-list-events
Parameters
- timeZone TimeZone? (default ()) - Preferred Time Zone of the start and end time. (Default :
UTC
)
- contentType ContentType? (default ()) - Preferred Content-Type of the body. Values :
text
ortext
(Default :html
)
- queryParams string? (default ()) - Query parameters. This method support OData query parameters to customize the response.
It should be an array of type
string
in the format<QUERY_PARAMETER_NAME>=<PARAMETER_VALUE>
Note: For more information about query parameters, refer here: https://docs.microsoft.com/en-us/graph/query-parameters
addQuickEvent![](/images/permalink.svg)
Quick add event This create a event with minimum necessary inputs. API doc : https://docs.microsoft.com/en-us/graph/api/user-post-events
Parameters
- subject string - Subject of the event
- description string? (default ()) - Description of the event
- calendarId string? (default ()) - Calendar ID of the calendar that you want to create the event. If not, Default will be used.
createEvent![](/images/permalink.svg)
function createEvent(EventMetadata eventMetadata, string? calendarId) returns Event|error
Create an event This create a new event with Event object as parameters. API doc : https://docs.microsoft.com/en-us/graph/api/user-post-events
Parameters
- eventMetadata EventMetadata - Metadata related to Event that we are passing on input.
- calendarId string? (default ()) - Calendar ID of the calendar that you want to create the event.
updateEvent![](/images/permalink.svg)
function updateEvent(string eventId, EventMetadata eventMetadata, string? calendarId) returns Event|error
Update an event This updates the properties of a Event object. API doc : https://docs.microsoft.com/en-us/graph/api/event-update
Parameters
- eventId string - ID of an event.
- eventMetadata EventMetadata - Metadata related to Event that we are passing on input.
- calendarId string? (default ()) - Calendar ID of the calendar that you want to update the event.
deleteEvent![](/images/permalink.svg)
Delete an event This removes the specified event from the containing calendar. API doc : https://docs.microsoft.com/en-us/graph/api/event-delete
Parameters
- eventId string - ID of an event.
Return Type
- error? -
error
if failed.
createCalendar![](/images/permalink.svg)
function createCalendar(CalendarMetadata calendarMetadata) returns Calendar|error
################################################################################## Operations on a Calendar resource The Calendar resource is the top-level object representing a calendar in outlook. ################################################################################# Create a calendar This create a new calendar for the user. API doc : https://docs.microsoft.com/en-us/graph/api/user-post-calendars
Parameters
- calendarMetadata CalendarMetadata - Metadata related to calendar that we are passing on input.
deleteCalendar![](/images/permalink.svg)
Delete a calendar This removes the specified calendar. API doc : https://docs.microsoft.com/en-us/graph/api/calendar-delete
Parameters
- calendarId string - ID of a calendar.
Return Type
- error? -
error
if failed.
getCalendar![](/images/permalink.svg)
Get a calendar by proving the ID Get the properties and relationships of a calendar object. API doc : https://docs.microsoft.com/en-us/graph/api/calendar-get
Parameters
- calendarId string - ID of an event. Read-only.
- queryParams string? (default ()) - Optional query parameters. This method support OData query parameters to customize the response.
It should be an array of type
string
in the format<QUERY_PARAMETER_NAME>=<PARAMETER_VALUE>
Note: For more information about query parameters, refer here: https://docs.microsoft.com/en-us/graph/query-parameters
updateCalendar![](/images/permalink.svg)
function updateCalendar(string calendarId, string? name, CalendarColor? color, boolean? isDefaultCalendar) returns Calendar|error
Update a calender This updates the properties of a calendar object. API doc : https://docs.microsoft.com/en-us/graph/api/calendar-update
Parameters
- calendarId string - ID of an calendar.
- name string? (default ()) - Name of the calendar.
- color CalendarColor? (default ()) - Color of the calendar.
- isDefaultCalendar boolean? (default ()) - Default calendar.
listCalendars![](/images/permalink.svg)
Get list of calendars. Get all the user's calendars. API doc : https://docs.microsoft.com/en-us/graph/api/user-list-calendars
Parameters
- queryParams string? (default ()) - Optional query parameters. This method support OData query parameters to customize the response.
It should be an array of type
string
in the format<QUERY_PARAMETER_NAME>=<PARAMETER_VALUE>
Note: For more information about query parameters, refer here: https://docs.microsoft.com/en-us/graph/query-parameters
Enums![](/images/permalink.svg)
microsoft.outlook.calendar: AttendeeType![](/images/permalink.svg)
Members
microsoft.outlook.calendar: CalendarColor![](/images/permalink.svg)
Members
microsoft.outlook.calendar: ContentType![](/images/permalink.svg)
Members
microsoft.outlook.calendar: EventType![](/images/permalink.svg)
Members
microsoft.outlook.calendar: Importance![](/images/permalink.svg)
Members
microsoft.outlook.calendar: LocationType![](/images/permalink.svg)
Members
microsoft.outlook.calendar: OnlineMeetingProviderType![](/images/permalink.svg)
Members
microsoft.outlook.calendar: PhoneType![](/images/permalink.svg)
Members
microsoft.outlook.calendar: RecurrencePattern![](/images/permalink.svg)
Describes the frequency by which a recurring event repeats.
You can specify the recurrence pattern of a recurring event in one of 6 ways depending on your scenario. For each pattern type, specify the amount of time between occurrences. The actual occurrences of the recurring event always follow this pattern falling within the date range that you specify for the event. A recurring event is always defined by its recurrencePattern(how frequently the event repeats), and its recurrenceRange (over how long the event repeats).
API Doc : https://docs.microsoft.com/en-us/graph/api/resources/recurrencepattern?view=graph-rest-1.0
Members
microsoft.outlook.calendar: RecurrenceRangeType![](/images/permalink.svg)
Members
microsoft.outlook.calendar: ResponseType![](/images/permalink.svg)
Members
microsoft.outlook.calendar: Sensitivity![](/images/permalink.svg)
Members
microsoft.outlook.calendar: ShowAs![](/images/permalink.svg)
Members
microsoft.outlook.calendar: TimeZone![](/images/permalink.svg)
Members
Records![](/images/permalink.svg)
microsoft.outlook.calendar: Attendee![](/images/permalink.svg)
Fields
- emailAddress EmailAddress? -
- proposedNewTime TimeSlot? -
- status ResponseStatus? -
- 'type string? -
microsoft.outlook.calendar: Calendar![](/images/permalink.svg)
Get the properties and relationships of the specified calendar object. Calendar Resource
Fields
- Fields Included from *GeneratedCalendarData
- Fields Included from *CalendarMetadata
- name string
- isDefaultCalendar boolean|()
- allowedOnlineMeetingProviders OnlineMeetingProviderType[]
- canEdit boolean
- canShare boolean
- isRemovable boolean
- isTallyingResponses boolean
- canViewPrivateItems boolean
- color maxColor|lightRed|lightBrown|lightPink|lightTeal|lightYellow|lightGray|lightOrange|lightGreen|lightBlue|auto|()
- defaultOnlineMeetingProvider OnlineMeetingProviderType
- owner EmailAddress
- anydata...
microsoft.outlook.calendar: CalendarMetadata![](/images/permalink.svg)
Fields
- name string? -
- isDefaultCalendar boolean? -
- allowedOnlineMeetingProviders OnlineMeetingProviderType[]? -
- canEdit boolean? -
- canShare boolean? -
- isRemovable boolean? -
- isTallyingResponses boolean? -
- canViewPrivateItems boolean? -
- color CalendarColor? -
- defaultOnlineMeetingProvider OnlineMeetingProviderType? -
- owner EmailAddress? -
microsoft.outlook.calendar: ConnectionConfig![](/images/permalink.svg)
Represents configuration parameters to create Microsoft Calendar.
Fields
- auth BearerTokenConfig|OAuth2RefreshTokenGrantConfig - Configurations related to client authentication
- httpVersion string(default "1.1") - The HTTP version understood by the client
- http1Settings ClientHttp1Settings(default {}) - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings(default {}) - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- followRedirects FollowRedirects?(default ()) - Configurations associated with Redirection
- poolConfig PoolConfiguration?(default ()) - Configurations associated with request pooling
- cache CacheConfig(default {}) - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig?(default ()) - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig?(default ()) - Configurations associated with retrying
- cookieConfig CookieConfig?(default ()) - Configurations associated with cookies
- responseLimits ResponseLimitConfigs(default {}) - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket?(default ()) - SSL/TLS-related options
microsoft.outlook.calendar: CookieConfig![](/images/permalink.svg)
Client configuration for cookies.
Fields
- enabled boolean(default false) - User agents provide users with a mechanism for disabling or enabling cookies
- maxCookiesPerDomain int(default 50) - Maximum number of cookies per domain, which is 50
- maxTotalCookieCount int(default 3000) - Maximum number of total cookies allowed to be stored in cookie store, which is 3000
- blockThirdPartyCookies boolean(default true) - User can block cookies from third party responses and refuse to send cookies for third party requests, if needed
microsoft.outlook.calendar: DateTimeTimeZone![](/images/permalink.svg)
Fields
- dateTime string? -
- timeZone string? -
microsoft.outlook.calendar: EmailAddress![](/images/permalink.svg)
Fields
- address string? -
- name string? -
microsoft.outlook.calendar: Event![](/images/permalink.svg)
Get the properties and relationships of the specified event object. Event Resource
Fields
- Fields Included from *GeneratedEventData
- Fields Included from *EventMetadata
- subject string|()
- body ItemBody
- bodyPreview string
- categories string[]
- originalStartTimeZone string
- originalEndTimeZone string
- start DateTimeTimeZone|()
- end DateTimeTimeZone|()
- location Location
- locations Location[]
- attendees Attendee[]
- recurrence PatternedRecurrence|()
- allowNewTimeProposals boolean
- hasAttachments boolean
- hideAttendees boolean
- isAllDay boolean
- isOnlineMeeting boolean
- isReminderOn boolean
- importance Importance
- reminderMinutesBeforeStart int
- responseRequested boolean
- responseStatus ResponseStatus
- sensitivity Sensitivity
- showAs ShowAs
- onlineMeetingProvider OnlineMeetingProviderType
- anydata...
microsoft.outlook.calendar: EventMetadata![](/images/permalink.svg)
Metadata related to Event
resource
Fields
- subject string? - The text of the event's subject line
- body ItemBody? - The body of the message associated with the event. It can be in HTML or text format
- bodyPreview string? - The preview of the message associated with the event. It is in text format
- categories string[]? - The categories associated with the event
- originalStartTimeZone string? - The start time zone that was set when the event was created A value of tzone://Microsoft/Custom indicates that a legacy custom time zone was set in desktop Outlook
- originalEndTimeZone string? - The end time zone that was set when the event was created A value of tzone://Microsoft/Custom indicates that a legacy custom time zone was set in desktop Outlook
- 'start DateTimeTimeZone? - The date, time, and time zone that the event starts. By default, the start time is in UTC
- end DateTimeTimeZone? - The date, time, and time zone that the event ends. By default, the end time is in UTC
- location Location? - The location of the event
- locations Location[]? - The locations where the event is held or attended from The location and locations properties always correspond with each other If you update the location property, any prior locations in the locations collection would be removed and replaced by the new location value
- attendees Attendee[]? - The collection of attendees for the event
- recurrence PatternedRecurrence? - The recurrence pattern for the event
- allowNewTimeProposals boolean? - True if the meeting organizer allows invitees to propose a new time when responding, false otherwise. Optional. Default is true
- hasAttachments boolean? - Set to true if the event has attachments
- hideAttendees boolean? - When set to true, each attendee only sees themselves in the meeting request & meeting Tracking list. Default is false
- isAllDay boolean? - Set to true if the event lasts all day
- isOnlineMeeting boolean? - True if this event has online meeting information, false otherwise. Default is false. Optional
- isReminderOn boolean? - Set to true if an alert is set to remind the user of the event
- importance Importance? - The importance of the event. The possible values are: low, normal, high
- reminderMinutesBeforeStart int? - The number of minutes before the event start time that the reminder alert occurs
- responseRequested boolean? - Default is true, which represents the organizer would like an invitee to send a response to the event
- responseStatus ResponseStatus? - Indicates the type of response sent in response to an event message
- sensitivity Sensitivity? - The possible values are: normal, personal, private, confidential
- showAs ShowAs? - The status to show. The possible values are: free, tentative, busy, oof, workingElsewhere, unknown
- onlineMeetingProvider OnlineMeetingProviderType? - Represents the online meeting service provider The possible values are teamsForBusiness, skypeForBusiness, and skypeForConsumer. Optional
microsoft.outlook.calendar: GeneratedCalendarData![](/images/permalink.svg)
Fields
- idreadonly string -
- hexColorreadonly string? -
- changeKeyreadonly string? -
microsoft.outlook.calendar: GeneratedEventData![](/images/permalink.svg)
Generated Event
Data.
Fields
- idreadonly string - Unique ID for event. Read-only
- changeKey string? - Identifies the version of the event object. Every time the event is changed, ChangeKey changes as well This allows Exchange to apply changes to the correct version of the object
- createdDateTime string? - The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z
- occurrenceId string? - Unique ID for occurrence
- transactionId string? - A custom identifier specified by a client app for the server to avoid redundant POST operations in case of client retries to create the same event. This is useful when low network connectivity causes the client to time out before receiving a response from the server for the client's prior create-event request. After you set transactionId when creating an event, you cannot change transactionId in a subsequent update This property is only returned in a response payload if an app has set it. Optional.
- seriesMasterId string? - The ID for the recurring series master item, if this event is part of a recurring series
- onlineMeetingUrlreadonly string? - A URL for an online meeting The property is set only when an organizer specifies an event as an online meeting such as a Skype meeting. Read-only
- iCalUId string? - A unique identifier for an event across calendars. This ID is different for each occurrence in a recurring series. Read-only
- onlineMeeting OnlineMeetingInfo? - Details for an attendee to join the meeting online. Read-only.
- organizer Recipient? - The organizer of the event
- originalStart string? - The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z
- 'typereadonly EventType? - The event type. The possible values are: singleInstance, occurrence, exception, seriesMaster. Read-only
- webLinkreadonly string? - The URL to open the event in Outlook on the web.Outlook on the web opens the event in the browser if you are signed in to your mailbox. Otherwise, Outlook on the web prompts you to sign in. This URL cannot be accessed from within an iFrame
microsoft.outlook.calendar: ItemBody![](/images/permalink.svg)
Fields
- contentType string? -
- content string? -
microsoft.outlook.calendar: Location![](/images/permalink.svg)
Fields
- address PhysicalAddress? -
- coordinates OutlookGeoCoordinates? -
- displayName string? -
- locationEmailAddress string? -
- locationUri string? -
- locationType LocationType? -
microsoft.outlook.calendar: OnlineMeetingInfo![](/images/permalink.svg)
Details for an attendee to join the meeting online. Read-only.
Fields
- conferenceId string? - The ID of the conference
- joinUrl string? - The external link that launches the online meeting. This is a URL that clients will launch into a browser and will redirect the user to join the meeting
- phones Phone? - All of the phone numbers associated with this conference
- quickDial string? - All of the phone numbers associated with this conference
- tollFreeNumbers string[]? - The toll free numbers that can be used to join the conference
- tollNumber string? - The toll number that can be used to join the conference
microsoft.outlook.calendar: OutlookGeoCoordinates![](/images/permalink.svg)
Fields
- accuracy float? -
- altitude float? -
- altitudeAccuracy float? -
- latitude float? -
- longitude float? -
microsoft.outlook.calendar: PatternedRecurrence![](/images/permalink.svg)
The recurrence pattern and range.
Fields
- pattern RecurrencePattern? - The frequency of an event. Do not specify for a one-time access review
- range RecurrenceRange? - The duration of an event
microsoft.outlook.calendar: Phone![](/images/permalink.svg)
Fields
- number string? -
- 'type PhoneType? -
microsoft.outlook.calendar: PhysicalAddress![](/images/permalink.svg)
Fields
- city string? -
- countryOrRegion string? -
- postalCode string? -
- state string? -
- street string? -
microsoft.outlook.calendar: Recipient![](/images/permalink.svg)
Represents information about a user in the sending or receiving end of an event, message or group post.
Fields
- emailAddress EmailAddress? - The recipient's email address
microsoft.outlook.calendar: RecurrenceRange![](/images/permalink.svg)
Describes a date range over which a recurring event repeats.
You can specify the date range for a recurring event in one of 3 ways depending on your scenario While you must always specify a startDate value for the date range, you can specify a recurring event that ends by a specific date, or that doesn't end, or that ends after a specific number of occurrences.
Note that the actual occurrences within the date range always follow the recurrence pattern that you specify for the recurring event. A recurring event is always defined by its recurrencePattern (how frequently the event repeats), and its recurrenceRange (for how long the event repeats).
Fields
- endDate string? - The date to stop applying the recurrence pattern Depending on the recurrence pattern of the event, the last occurrence of the meeting may not be this date. Required if type is endDate
- numberOfOccurrences int? - The number of times to repeat the event. Required and must be positive if type is numbered.
- recurrenceTimeZone string? - Time zone for the startDate and endDate properties Optional. If not specified, the time zone of the event is used
- startDate string? - The date to start applying the recurrence pattern. The first occurrence of the meeting may be this date or later, depending on the recurrence pattern of the event. Must be the same value as the start property of the recurring event. Required
- 'type RecurrenceRangeType? - The recurrence range. The possible values are: endDate, noEnd, numbered. Required
microsoft.outlook.calendar: ResponseStatus![](/images/permalink.svg)
Fields
- response ResponseType? -
- time string? -
microsoft.outlook.calendar: TimeSlot![](/images/permalink.svg)
Fields
- 'start DateTimeTimeZone? -
- end DateTimeTimeZone? -
Import
import ballerinax/microsoft.outlook.calendar;
Metadata
Released date: over 2 years ago
Version: 2.1.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: slbeta6
GraalVM compatible: Yes
Pull count
Total: 3
Current verison: 1
Weekly downloads
Keywords
Productivity/Calendars
Cost/Free
Vendor/Microsoft
Contributors