Hey. Are you stuck in the year 2020?
Are you trying backup Microsoft To Do tasks with PowerShell and Microsoft Graph?
Have you become infuriated because the Graph API doesn’t let you export sub-tasks?
Well, the good news is that in 2022 – in the future – Microsoft Graph will add support for what they call a checklistItem resource type, which you could very possibly add to the PowerShell solution.
But for the rest of this blog post, let’s pretend that’s not the case, because there is a neat way of extracting all your Microsoft To Do data from your very own web browser.
So stop washing that orange, pick up the nearest fidget spinner, and let’s get crocing…
When you open To Do in your web browser, you see all of your lists, tasks, sub-tasks, and so on. If you disconnect from the internet, you can still click through everything. So “the stuff” must be somewhere on your device. But what is the stuff and where does it live?
Microsoft To Do is a single-page application and it stores its data in IndexedDB, a client-side data store built into modern web browsers. Here’s what my To Do database looks like in Chrome’s developer tools:
And here’s an example from my lists, the somewhat-useful “List o list”:
You see that the list has a unique identifier – id. As you might hope, a task has a field called list_id, which links it to its parent. A task has an id of its own, which is referenced by a step (sub-task) as – you guessed it – task_id. It’s IDs all the way and the data we need is clearly there. But how do we get it?
Thankfully, Florian Reuschel has written a fantastic code snippet that lets you dump an IndexedDB database to JSON in your dev tools console. I’ve put some step-by-step instructions on GitHub here.
The JSON file on its own serves as a form of backup – all of your data is present, even if it’s not in an immediately useful format.
I’ve also put a Python script on GitHub that converts the JSON file to Asana’s CSV Importer format.
It was a “write once, run once” kind of thing, made for someone who got in touch via my blog (hi Charlie!). It’s not a masterpiece of modular software design and it has to deal with some quirks in Asana’s API. But I think it’s fairly easy to reason with and hopefully can serve as inspiration if you need to do something similar.
Does it even work?
The process relies on undocumented behaviour, so a solution using the updated Graph API would strictly be more correct (but less fun).
However, at the time of writing, the whole thing works suprisingly well, so if you do want to migrate from Microsoft To Do from Asana it might be worth trying. As ever, make sure you test with some dummy data/test accounts before you commit to anything permanent.