Tasks
Methods for accessing MS Tasks/Todos via the MS Graph api.
- class O365.tasks.Folder(*, parent=None, con=None, **kwargs)[source]
Bases:
ApiComponent
A Microsoft To-Do folder.
- __init__(*, parent=None, con=None, **kwargs)[source]
Representation of a Microsoft To-Do Folder.
- Parameters:
parent (ToDo) – parent object
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_task(param)[source]
Return a Task instance by it’s id.
- Parameters:
param – an task_id or a Query instance
- Returns:
task for the specified info
- Return type:
- get_tasks(query=None, batch=None, order_by=None)[source]
Return list of tasks of a specified folder.
- Parameters:
query – the query string or object to query tasks
batch – the batch on to retrieve tasks.
order_by – the order clause to apply to returned tasks.
- Return type:
tasks
- update()[source]
Update this folder. Only name can be changed.
- Returns:
Success / Failure
- Return type:
bool
- folder_id
The identifier of the task list, unique in the user’s mailbox.
Type: str
- is_default
Is the defaultList.
Type: bool
- name
The name of the task list.
Type: str
- class O365.tasks.Task(*, parent=None, con=None, **kwargs)[source]
Bases:
ApiComponent
A Microsoft To-Do task.
- __init__(*, parent=None, con=None, **kwargs)[source]
Representation of a Microsoft To-Do task.
- Parameters:
parent (Folder) – parent object
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)
folder_id (str) – id of the calender to add this task in (kwargs)
subject (str) – subject of the task (kwargs)
- get_body_soup()[source]
Return 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
- save()[source]
Create a new task or update an existing one.
Does update by checking what values have changed and update them on the server :return: Success / Failure :rtype: bool
- to_api_data(restrict_keys=None)[source]
Return a dict to communicate with the server.
- Parameters:
restrict_keys – a set of keys to restrict the returned data to
- Return type:
dict
- property body
Return Body of the task.
- Getter:
Get body text
- Setter:
Set body of task
- Type:
str
- body_type
The type of the content. Possible values are text and html.
Type: str
- property completed
Completed Time of task.
- Getter:
Get the completed time
- Setter:
Set the completed time
- Type:
datetime
- property created
Return Created time of the task.
- Type:
datetime
- property due
Due Time of task.
- Getter:
Get the due time
- Setter:
Set the due time
- Type:
datetime
- folder_id
Identifier of the containing folder.
Type: str
- property importance
Return Task importance.
- Getter:
Get importance level (Low, Normal, High)
- Type:
str
- property is_completed
Is task completed or not.
- Getter:
Is completed
- Setter:
Set the task to completed
- Type:
bool
- property is_reminder_on
Return isReminderOn of the task.
- Getter:
Get isReminderOn
- Type:
bool
- property is_starred
Is the task starred (high importance).
- Getter:
Check if importance is high
- Type:
bool
- property modified
Return Last modified time of the task.
- Type:
datetime
- property reminder
Reminder Time of task.
- Getter:
Get the reminder time
- Setter:
Set the reminder time
- Type:
datetime
- property status
Status of task
- Getter:
Get status
- Type:
str
- property subject
Subject of the task.
- Getter:
Get subject
- Setter:
Set subject of task
- Type:
str
- task_id
Unique identifier for the task.
Type: str
- class O365.tasks.ToDo(*, parent=None, con=None, **kwargs)[source]
Bases:
ApiComponent
A Microsoft To-Do class for MS Graph API.
In order to use the API following permissions are required. Delegated (work or school account) - Tasks.Read, Tasks.ReadWrite
- __init__(*, parent=None, con=None, **kwargs)[source]
Initialise the ToDo object.
- Parameters:
parent (Account) – parent object
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_folder(folder_id=None, folder_name=None)[source]
Return a folder by it’s id or name.
- Parameters:
folder_id (str) – the folder id to be retrieved.
folder_name (str) – the folder name to be retrieved.
- Returns:
folder for the given info
- Return type:
- get_tasks(batch=None, order_by=None)[source]
Get tasks from the default Calendar.
- Parameters:
order_by – 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:
list of items in this folder
- Return type:
list[Task] or Pagination
- list_folders(query=None, limit=None)[source]
Return a list of folders.
To use query an order_by check the OData specification here: https://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/ part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions -complete.html :param query: the query string or object to list folders :param int limit: max no. of folders to get. Over 999 uses batch. :rtype: list[Folder]