Access Microsoft Todo List via Rest API

4.5k Views Asked by At

I want to get my to-dos from my Microsoft Todo (https://to-do.live.com) but I don't have a clue on how to get started. I searched online but did not find documentation for a REST API.

Does anyone know how to access certain Todo lists from MS Todo (formerly known as Wunderlist)? Is the Graph API the place to look? I don't have an Office 365 account.

2

There are 2 best solutions below

1
Satya V On BEST ANSWER

You could use Graph API for to-do tasks

For example to list all the tasks categories :

enter image description here

To access tasks under a specific category :

https://graph.microsoft.com/v1.0/me/todo/lists/{id}/tasks

with the token in the request body to authorize the request.

Authorization : Bearer <Token>

To get Token

I understand you don't have any Office 365 Work accounts.

Access the below url and login

https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps

Login using your personal account credentials.

Register app :

enter image description here

Once registration is complete, you will be getting app credentials.

Once Registration done. Grant the permissions :

App --> App Name --> API Permissions --> Graph Api

Check the below Tasks delegated permissions

enter image description here

You can authorize the client using the below url :

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id={client_id}&scope={scope}
    &response_type=token&redirect_uri={redirect_uri}

Obtain the token.

0
Hashim Aziz On

In my case I was trying to quickly set up something to randomly pick a task from one of my To-Do lists, and to do that I first needed to get all the tasks in the list - something that should have been pretty simple. After spending a few hours trying to deal with the Azure ecosystem's convoluted authentication issues and cryptic errors (both made worse by incomplete documentation), I decided to just go with the Graph API's command-line tool instead.

Once you've installed the latest version from the Releases page, run:

mgc login --strategy InteractiveBrowser --scopes Tasks.ReadWrite

This will open a browser tab that will let you login to your Microsoft account and enable read and write permissions for the CLI tool.

Next, making sure you're logged into the same Microsoft account, open the Graph Explorer (a useful web interface for testing the Graph API).

Run the following query in the Explorer (usually this is the default query anyway):

https://graph.microsoft.com/v1.0/me

...and check the Response preview tab in the bottom pane for an id field - the value in this id field is your USER_ID and will be needed to access your To-Do account.

Finally, run the following query:

https://graph.microsoft.com/v1.0/me/todo/lists

In the response look for the name of the To-Do list that you're trying to work with, and take a note of its id value - this is your LIST_ID.

With these two pieces of information you can now run the MS Graph CLI command you need to run, making sure to pass both of them to the command.

For example, this is what I used to get a full list of my (uncompleted) tasks in one of my To-Do lists:

mgc users todo lists tasks list --user-id USER_ID --todo-task-list-id LIST_ID
--filter "Status ne 'Completed'" --top 2000 | jq '.value .[] .title'
# --top 2000 is needed to return all the results - by default 
#  the API returns them paged, 50 results at a time

For an idea of the CLI commands that you need for your purposes, try running the sample API queries in the left sidebar of the Graph Explorer - or write and run your own - and click the Code Snippets tab in the bottom pane and the CLI subtab to get a "translation" of the query for the mgc tool.