Calendar

class O365.calendar.Attendee(address, *, name=None, attendee_type=None, response_status=None, event=None)[source]

Bases: object

A Event attendee

__init__(address, *, name=None, attendee_type=None, response_status=None, event=None)[source]

Create a event attendee

Parameters:
  • address (str) – email address of the attendee

  • name (str) – name of the attendee

  • attendee_type (AttendeeType) – requirement of attendee

  • response_status (Response) – response status requirement

  • event (Event) – event for which to assign the attendee

property address

Email address

Getter:

Get the email address of attendee

Setter:

Set the email address of attendee

Type:

str

property attendee_type

Requirement of the attendee

Getter:

Get the requirement of attendee

Setter:

Set the requirement of attendee

Type:

AttendeeType

property name

Name

Getter:

Get the name of attendee

Setter:

Set the name of attendee

Type:

str

property response_status

Response status of the attendee

Type:

ResponseStatus

class O365.calendar.AttendeeType(*values)[source]

Bases: CaseEnum

Optional = 'optional'
Required = 'required'
Resource = 'resource'
class O365.calendar.Attendees(event, attendees=None)[source]

Bases: ApiComponent

A Collection of Attendees

__init__(event, attendees=None)[source]

Create a collection of attendees

Parameters:
  • event (Event) – event for which to assign the attendees

  • attendees (str or tuple(str, str) or Attendee or list[str] or list[tuple(str,str)] or list[Attendee]) – list of attendees to add

add(attendees)[source]

Add attendees to the parent event

Parameters:

attendees (str or tuple(str, str) or Attendee or list[str] or list[tuple(str,str)] or list[Attendee]) – list of attendees to add

clear()[source]

Clear the attendees list

remove(attendees)[source]

Remove the provided attendees from the event

Parameters:

attendees (str or tuple(str, str) or Attendee or list[str] or list[tuple(str,str)] or list[Attendee]) – list of attendees to add

to_api_data()[source]

Returns a dict to communicate with the server

Return type:

dict

class O365.calendar.Calendar(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent, HandleRecipientsMixin

__init__(*, parent=None, con=None, **kwargs)[source]

Create a Calendar Representation

Parameters:
  • parent (Schedule) – parent for this operation

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

delete()[source]

Deletes this calendar

Returns:

Success / Failure

Return type:

bool

get_event(param)[source]

Returns an Event instance by it’s id

Parameters:

param – an event_id or a Query instance

Returns:

event for the specified info

Return type:

Event

get_events(limit=25, *, query=None, order_by=None, batch=None, download_attachments=False, include_recurring=True)[source]

Get events from this Calendar

Parameters:
  • limit (int) – max no. of events to get. Over 999 uses batch.

  • query (Query or str) – applies a OData filter to the request

  • order_by (Query or str) – orders the result set based on this condition

  • batch (int) – batch size, retrieves items in batches allowing to retrieve more items than the limit.

  • download_attachments – downloads event attachments

  • include_recurring (bool) – whether to include recurring events or not

Returns:

list of events in this calendar

Return type:

list[Event] or Pagination

new_event(subject=None)[source]

Returns a new (unsaved) Event object

Return type:

Event

update()[source]

Updates this calendar. Only name and color can be changed.

Returns:

Success / Failure

Return type:

bool

calendar_id

The calendar’s unique identifier.

   Type: str

can_edit

true if the user can write to the calendar, false otherwise.

   Type: bool

can_share

true if the user has permission to share the calendar, false otherwise.

   Type: bool

can_view_private_items

If true, the user can read calendar items that have been marked private, false otherwise.

   Type: bool

color

Specifies the color theme to distinguish the calendar from other calendars in a UI.

   Type: calendarColor

hex_color

The calendar color, expressed in a hex color code of three hexadecimal values, each ranging from 00 to FF and representing the red, green, or blue components of the color in the RGB color space.

   Type: str

name

The calendar name.

   Type: str

property owner

Owner of the calendar

Return type:

str

class O365.calendar.CalendarColor(*values)[source]

Bases: CaseEnum

Auto = 'auto'
LightBlue = 'light_blue'
LightBrown = 'light_brown'
LightGray = 'light_gray'
LightGreen = 'light_green'
LightOrange = 'light_orange'
LightPink = 'light_pink'
LightRed = 'light_red'
LightTeal = 'light_teal'
LightYellow = 'light_yellow'
MaxColor = 'max_color'
class O365.calendar.DailyEventFrequency(recurrence_type, interval)[source]

Bases: object

__init__(recurrence_type, interval)[source]
class O365.calendar.Event(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent, AttachableMixin, HandleRecipientsMixin

A Calendar event

__init__(*, parent=None, con=None, **kwargs)[source]

Create a calendar event representation

Parameters:
  • parent (Calendar or Schedule or ApiComponent) – parent for this operation

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

  • calendar_id (str) – id of the calender to add this event in (kwargs)

  • download_attachments (bool) – whether or not to download attachments (kwargs)

  • subject (str) – subject of the event (kwargs)

accept_event(comment=None, *, send_response=True, tentatively=False)[source]

Accept the event

Parameters:
  • comment – comment to add

  • send_response – whether or not to send response back

  • tentatively – whether acceptance is tentative

Returns:

Success / Failure

Return type:

bool

cancel_event(comment=None, *, send_response=True)[source]

Cancel the event

Parameters:
  • comment (str) – comment to add

  • send_response (bool) – whether or not to send response back

Returns:

Success / Failure

Return type:

bool

decline_event(comment=None, *, send_response=True)[source]

Decline the event

Parameters:
  • comment (str) – comment to add

  • send_response (bool) – whether or not to send response back

Returns:

Success / Failure

Return type:

bool

delete()[source]

Deletes a stored event

Returns:

Success / Failure

Return type:

bool

get_body_soup()[source]

Returns the beautifulsoup4 of the html body

Returns:

Html body

Return type:

BeautifulSoup

get_body_text()[source]

Parse the body html and returns the body text using bs4

Returns:

body text

Return type:

str

get_occurrences(start, end, *, limit=None, query=None, order_by=None, batch=None)[source]

Returns all the occurrences of a seriesMaster event for a specified time range.

Parameters:
  • start (datetime) – the start of the time range

  • end (datetime) – the end of the time range

  • limit (int) – ax no. of events to get. Over 999 uses batch.

  • query (Query or str) – optional. extra filters or ordes to apply to this query

  • order_by (str) – orders the result set based on this condition

  • batch (int) – batch size, retrieves items in batches allowing to retrieve more items than the limit.

Returns:

a list of events

Return type:

list[Event] or Pagination

save()[source]

Create a new event or update an existing one by checking what values have changed and update them on the server

Returns:

Success / Failure

Return type:

bool

to_api_data(restrict_keys=None)[source]

Returns a dict to communicate with the server

Parameters:

restrict_keys – a set of keys to restrict the returned data to

Return type:

dict

property attachments

List of attachments

Return type:

EventAttachments

property attendees

List of meeting attendees

Return type:

Attendees

property body

Body of the event

Getter:

Get body text

Setter:

Set body of event

Type:

str

body_type

The type of the content. Possible values are text and html.

   Type: bodyType

calendar_id

The calendar’s unique identifier.

   Type: str

property categories

Categories of the event

Getter:

get the list of categories

Setter:

set the list of categories

Type:

list[str]

property created

Created time of the event

Return type:

datetime

property end

End Time of event

Getter:

get the end time

Setter:

set the end time

Type:

datetime

property event_type
has_attachments

Set to true if the event has attachments.

   Type: bool

ical_uid

A unique identifier for an event across calendars. This ID is different for each occurrence in a recurring series.

   Type: str

property importance

Event Priority

Getter:

get importance of event

Setter:

set the importance of event

Type:

ImportanceLevel

property is_all_day

Is the event for whole day

Getter:

get the current status of is_all_day property

Setter:

set if the event is all day or not

Type:

bool

is_cancelled

Set to true if the event has been cancelled.

   Type: bool

property is_online_meeting

Status of the online_meeting

Getter:

check is online_meeting enabled or not

Setter:

enable or disable online_meeting option

Type:

bool

is_organizer

Set to true if the calendar owner (specified by the owner property of the calendar) is the organizer of the event (specified by the organizer property of the event). It also applies if a delegate organized the event on behalf of the owner.

   Type: bool

property is_reminder_on

Status of the Reminder

Getter:

check is reminder enabled or not

Setter:

enable or disable reminder option

Type:

bool

property location

Location of event

Getter:

get current location configured for the event

Setter:

set a location for the event

Type:

str

locations

The locations where the event is held or attended from.

   Type: list

property modified

Last modified time of the event

Return type:

datetime

property no_forwarding
object_id

Unique identifier for the event.

   Type: str

online_meeting

Details for an attendee to join the meeting online. The default is null.

   Type: OnlineMeetingInfo

property online_meeting_provider

online_meeting_provider of event

Getter:

get current online_meeting_provider configured for the event

Setter:

set a online_meeting_provider for the event

Type:

OnlineMeetingProviderType

online_meeting_url

A URL for an online meeting.

   Type: str

property organizer

Organizer of the meeting event

Return type:

Recipient

property recurrence

Recurrence information of the event

Return type:

EventRecurrence

property remind_before_minutes

No. of minutes to remind before the meeting

Getter:

get current minutes

Setter:

set to remind before new x minutes

Type:

int

property response_requested

Is response requested or not

Getter:

Is response requested or not

Setter:

set the event to request response or not

Type:

bool

property response_status

Your response

Return type:

ResponseStatus

property sensitivity

Sensitivity of the Event

Getter:

Get the current sensitivity

Setter:

Set a new sensitivity

Type:

EventSensitivity

series_master_id

The ID for the recurring series master item, if this event is part of a recurring series.

   Type: str

property show_as

Show as “busy” or any other status during the event

Getter:

Current status during the event

Setter:

update show as status

Type:

EventShowAs

property start

Start Time of event

Getter:

get the start time

Setter:

set the start time

Type:

datetime

property subject

Subject of the event

Getter:

Get subject

Setter:

Set subject of event

Type:

str

The URL to open the event in Outlook on the web.

   Type: str

class O365.calendar.EventAttachment(attachment=None, *, parent=None, **kwargs)[source]

Bases: BaseAttachment

class O365.calendar.EventAttachments(parent, attachments=None)[source]

Bases: BaseAttachments

class O365.calendar.EventRecurrence(event, recurrence=None)[source]

Bases: ApiComponent

__init__(event, recurrence=None)[source]

A representation of an event recurrence properties

Parameters:
  • event (Event) – event object

  • recurrence (dict) – recurrence information

set_daily(interval, **kwargs)[source]

Set to repeat every x no. of days

Parameters:
  • interval (int) – no. of days to repeat at

  • start (date) – Start date of repetition (kwargs)

  • end (date) – End date of repetition (kwargs)

  • occurrences (int) – no of occurrences (kwargs)

set_monthly(interval, *, day_of_month=None, days_of_week=None, index=None, **kwargs)[source]

Set to repeat every month on specified days for every x no. of days

Parameters:
  • interval (int) – no. of days to repeat at

  • day_of_month (int) – repeat day of a month

  • days_of_week (list[str]) – list of days of the week to repeat

  • index – index

  • start (date) – Start date of repetition (kwargs)

  • end (date) – End date of repetition (kwargs)

  • occurrences (int) – no of occurrences (kwargs)

set_range(start=None, end=None, occurrences=None)[source]

Set the range of recurrence

Parameters:
  • start (date) – Start date of repetition

  • end (date) – End date of repetition

  • occurrences (int) – no of occurrences

set_weekly(interval, *, days_of_week, first_day_of_week, **kwargs)[source]

Set to repeat every week on specified days for every x no. of days

Parameters:
  • interval (int) – no. of days to repeat at

  • first_day_of_week (str) – starting day for a week

  • days_of_week (list[str]) – list of days of the week to repeat

  • start (date) – Start date of repetition (kwargs)

  • end (date) – End date of repetition (kwargs)

  • occurrences (int) – no of occurrences (kwargs)

set_yearly(interval, month, *, day_of_month=None, days_of_week=None, index=None, **kwargs)[source]

Set to repeat every month on specified days for every x no. of days

Parameters:
  • interval (int) – no. of days to repeat at

  • month (int) – month to repeat

  • day_of_month (int) – repeat day of a month

  • days_of_week (list[str]) – list of days of the week to repeat

  • index – index

  • start (date) – Start date of repetition (kwargs)

  • end (date) – End date of repetition (kwargs)

  • occurrences (int) – no of occurrences (kwargs)

to_api_data()[source]

Returns a dict to communicate with the server

Return type:

dict

property day_of_month

Repeat on this day of month

Getter:

Get the repeat day of month

Setter:

Set the repeat day of month

Type:

int

property days_of_week

Days in week to repeat

Getter:

Get the current list of days

Setter:

Set the list of days to repeat

Type:

set(str)

property end_date

End date of repetition

Getter:

get the end date

Setter:

set the end date

Type:

date

property first_day_of_week

Which day to consider start of the week

Getter:

Get the current start of week

Setter:

Set the start day of week

Type:

str

property index

Index

Getter:

Get index

Setter:

Set index

Type:

str

property interval

Repeat interval for the event

Getter:

Get the current interval

Setter:

Update to a new interval

Type:

int

property month

Month of the event

Getter:

Get month

Setter:

Update month

Type:

int

property occurrences

No. of occurrences

Getter:

Get the no. of occurrences

Setter:

Set the no. of occurrences

Type:

int

property recurrence_time_zone

Timezone to consider for repeating

Getter:

Get the timezone

Setter:

Set the timezone

Type:

str

property start_date

Start date of repetition

Getter:

get the start date

Setter:

set the start date

Type:

date

class O365.calendar.EventResponse(*values)[source]

Bases: CaseEnum

Accepted = 'accepted'
Declined = 'declined'
NotResponded = 'not_responded'
Organizer = 'organizer'
TentativelyAccepted = 'tentatively_accepted'
class O365.calendar.EventSensitivity(*values)[source]

Bases: CaseEnum

Confidential = 'confidential'
Normal = 'normal'
Personal = 'personal'
Private = 'private'
class O365.calendar.EventShowAs(*values)[source]

Bases: CaseEnum

Busy = 'busy'
Free = 'free'
Oof = 'oof'
Tentative = 'tentative'
Unknown = 'unknown'
WorkingElsewhere = 'working_elsewhere'
class O365.calendar.EventType(*values)[source]

Bases: CaseEnum

Exception = 'exception'
Occurrence = 'occurrence'
SeriesMaster = 'series_master'
SingleInstance = 'single_instance'
class O365.calendar.OnlineMeetingProviderType(*values)[source]

Bases: CaseEnum

SkypeForBusiness = 'skype_for_business'
SkypeForConsumer = 'skype_for_consumer'
TeamsForBusiness = 'teams_for_business'
Unknown = 'unknown'
class O365.calendar.ResponseStatus(parent, response_status)[source]

Bases: ApiComponent

An event response status (status, time)

__init__(parent, response_status)[source]

An event response status (status, time)

Parameters:
  • parent (Attendees or Event) – parent of this

  • response_status (dict) – status info frm cloud

response_time

The time the response was received

   Type: datetime

status

The status of the response

   Type: str

class O365.calendar.Schedule(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

__init__(*, parent=None, con=None, **kwargs)[source]

Create a wrapper around calendars and events

Parameters:
  • parent (Account) – parent for this operation

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

get_availability(schedules, start, end, interval=60)[source]

Returns the free/busy availability for a set of users in a given time frame :param list schedules: a list of strings (email addresses) :param datetime start: the start time frame to look for available space :param datetime end: the end time frame to look for available space :param int interval: the number of minutes to look for space

get_calendar(calendar_id=None, calendar_name=None)[source]

Returns a calendar by it’s id or name

Parameters:
  • calendar_id (str) – the calendar id to be retrieved.

  • calendar_name (str) – the calendar name to be retrieved.

Returns:

calendar for the given info

Return type:

Calendar

get_default_calendar()[source]

Returns the default calendar for the current user

Return type:

Calendar

get_events(limit=25, *, query=None, order_by=None, batch=None, download_attachments=False, include_recurring=True)[source]

Get events from the default Calendar

Parameters:
  • limit (int) – max no. of events to get. Over 999 uses batch.

  • query (Query or str) – applies a OData filter to the request

  • order_by (Query or str) – orders the result set based on this condition

  • batch (int) – batch size, retrieves items in batches allowing to retrieve more items than the limit.

  • download_attachments (bool) – downloads event attachments

  • include_recurring (bool) – whether to include recurring events or not

Returns:

list of items in this folder

Return type:

list[Event] or Pagination

list_calendars(limit=None, *, query=None, order_by=None)[source]

Gets a list of calendars

To use query an order_by check the OData specification here: http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/ part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions -complete.html

Parameters:
  • limit (int) – max no. of calendars to get. Over 999 uses batch.

  • query (Query or str) – applies a OData filter to the request

  • order_by (Query or str) – orders the result set based on this condition

Returns:

list of calendars

Return type:

list[Calendar]

new_calendar(calendar_name)[source]

Creates a new calendar

Parameters:

calendar_name (str) – name of the new calendar

Returns:

a new Calendar instance

Return type:

Calendar

new_event(subject=None)[source]

Returns a new (unsaved) Event object in the default calendar

Parameters:

subject (str) – subject text for the new event

Returns:

new event

Return type:

Event