Skip to content

Commit 798f099

Browse files
author
Alejandro Casanovas
authored
Merge pull request #527 from alxhslm/tasks
Update README.md with tasks section
2 parents b851d7f + 3a3e826 commit 798f099

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

README.md

+60-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ What follows is kind of a wiki...
7171
- [AddressBook](#addressbook)
7272
- [Directory and Users](#directory-and-users)
7373
- [Calendar](#calendar)
74+
- [Tasks](#tasks)
7475
- [OneDrive](#onedrive)
7576
- [Excel](#excel)
7677
- [Sharepoint](#sharepoint)
@@ -377,6 +378,8 @@ calendar | 'Calendars.Read'
377378
calendar_shared | 'Calendars.Read.Shared'
378379
calendar_all | 'Calendars.ReadWrite'
379380
calendar_shared_all | 'Calendars.ReadWrite.Shared'
381+
tasks | 'Tasks.Read'
382+
tasks_all | 'Tasks.ReadWrite'
380383
users | 'User.ReadBasic.All'
381384
onedrive | 'Files.Read.All'
382385
onedrive_all | 'Files.ReadWrite.All'
@@ -988,7 +991,63 @@ for event in birthdays:
988991
For some unknow reason, microsoft does not allow to upload an attachment at the event creation time (as opposed with message attachments).
989992
See [this](https://stackoverflow.com/questions/46438302/office365-rest-api-creating-a-calendar-event-with-attachments?rq=1).
990993
So, to upload attachments to Events, first save the event, then attach the message and save again.
991-
994+
995+
## Tasks
996+
997+
The tasks functionality is grouped in a `ToDo` object. Note that the tasks functionality currently only works with the `MSOffice365Protocol` protocol.
998+
999+
A `ToDo` instance can list and create task folders. It can also list or create tasks on the default user folder. To use other folders use a `Folder` instance.
1000+
1001+
These are the scopes needed to work with the `ToDo`, `Folder` and `Task` classes.
1002+
1003+
Raw Scope | Included in Scope Helper | Description
1004+
:---: | :---: | ---
1005+
*Tasks.Read* | *tasks* | To only read my personal tasks
1006+
*Tasks.ReadWrite* | *tasks_all* | To read and save personal calendars
1007+
1008+
Working with the `ToDo` instance:
1009+
```python
1010+
import datetime as dt
1011+
1012+
# ...
1013+
todo = account.tasks()
1014+
1015+
#list current tasks
1016+
folder = todo.get_default_folder()
1017+
new_task = folder.new_task() # creates a new unsaved task
1018+
new_task.subject = 'Send contract to George Best'
1019+
new_task.due = dt.datetime(2020, 9, 25, 18, 30)
1020+
new_task.save()
1021+
1022+
#some time later....
1023+
1024+
new_task.mark_completed()
1025+
new_task.save()
1026+
1027+
# naive datetimes will automatically be converted to timezone aware datetime
1028+
# objects using the local timezone detected or the protocol provided timezone
1029+
# as with the Calendar functionality
1030+
1031+
```
1032+
1033+
Working with `Folder` instances:
1034+
1035+
```python
1036+
#create a new folder
1037+
new_folder = todo.new_folder('Defenders')
1038+
1039+
#rename a folder
1040+
folder = todo.get_folder(folder_name='Strikers')
1041+
folder.name = 'Forwards'
1042+
folder.update()
1043+
1044+
#list current tasks
1045+
task_list = folder.get_tasks()
1046+
for task in task_list:
1047+
print(task)
1048+
print('')
1049+
```
1050+
9921051
## OneDrive
9931052
The `Storage` class handles all functionality around One Drive and Document Library Storage in Sharepoint.
9941053

0 commit comments

Comments
 (0)