Processing Edge favorites

If you are like me and use the default Edge browser in Windows 10 despite that Chrome is much more popular among other users, you’ll also have favorites saved there. However, many times you might have a difficult time synchronizing them to other browsers or devices.

For example, if you want to simply import them in Chrome, that’s doable. But you cannot set Apple iCloud service to automatically synchronize Edge favorites to your iPhone’s Safari: iCloud only supports Chrome, Firefox or Internet Explorer.

As a .NET developer you think you could resolve this with some easy code writing, right? But then you understand that Edge favorites are saved into a special .edb file, which is an ESE database type (aka Blue Jet), and reading that file format is more difficult than you probably expected.

While you can use some nuget packages to actually read from that database using managed extensions for Microsoft’s esent.dll, I just found out that there is an easier way to do this and it should work from other environments too:

  • Get the free ESE database viewer from NirSoft – this doesn’t need installation, it’s just an executable file you can copy in your project;
  • Ensure Edge browser is closed (or, if you do this in a Windows service try the actions below periodically, catching file access exceptions and re-attempt later – Edge holds the database file in exclusive mode when running);
  • Run a command to export the favorites into a Temp.csv file (comma separated values) – such as using Process.Start:
ESEDatabaseView.exe /table "C:\Users\...\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default\DataStore\Data\nouser1\...\DBStore\spartan.edb" "Favorites" /scomma Temp.csv
  • Read the content of the Temp.csv file (once it’s crated and closed, i.e. the ESEDatabaseView.exe process completed), using a simple stream reader and splitting values on commas, as usual for CSV formatted data;
  • Skip deleted favorites and folder entries by checking IsDeleted and IsFolder fields (note that 255 means true, while probably any other value – I saw 42 in my case – means false);
  • Process the accepted entries as you wish using their Title and URL fields; e.g. save .url files in a folder like C:\Users\…\Favorites\Edge so that Internet Explorer sees them automatically in the Favorites section, and iCloud can synchronize them to your iPhone automatically if configured to synchronize items from Internet Explorer browser.
    • The name or the .url file should be the favorite title (encoded if needed).
    • Since the minimal content of a .url file can simply be a URL value you may skip adding any [InternetShortcut] section and URL= field definition there, and simply include only the actual value, like “https://codesections.wordpress.com” (without quote chars).
    • Note that processing the hierarchy of favorite folders might be more complex, but if your target is just synchronizing the flat list of names and URLs, the above should be enough.

Although this solution seems more simple, I haven’t had the time to implement it yet, so I decided to write this post for you guys to develop it if you need it too. And – if I don’t ask too much – I’d appreciate if you could also send me the GitHub link to it, assuming you want to publish it as open source code when it’s ready. Thank you in advance. 🙂

Advertisements

About Sorin Dolha

My passion is software development, but I also like physics.
This entry was posted in .NET, Miscellaneous and tagged , , , , , , , . Bookmark the permalink.

Add a reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s