Created
May 19, 2011 23:53
-
-
Save jongalloway/982055 to your computer and use it in GitHub Desktop.
Retrieving Live Writer account credentials via LiveWriter API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Source: Last comment at http://lozanotek.com/blog/archive/2007/07/22/Using_The_Windows_Live_Writer_API_To_Retrieve_Your_Blog_Password.aspx | |
using System; | |
using Microsoft.Win32; | |
// Add a ref to C:\Program Files\Windows Live\Writer\WindowsLive.Writer.BlogClient.dll | |
using WindowsLive.Writer.BlogClient; | |
// Add a ref to C:\Program Files\Windows Live\Writer\WindowsLive.Writer.CoreServices.dll | |
using WindowsLive.Writer.CoreServices.Settings; | |
using WindowsLive.Writer.CoreServices; | |
namespace RecoverLiveWriterCredentials | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
ApplicationEnvironment.Initialize(); | |
RegistrySettingsPersister persister = | |
new RegistrySettingsPersister(Registry.CurrentUser, | |
@"Software\\Microsoft\\Windows Live\\Writer\\Weblogs"); | |
string[] names = persister.GetSubSettings(); | |
for (int i = 0; i < names.Length; i++) | |
{ | |
ISettingsPersister blogPersister = persister.GetSubSettings(names[i]); | |
SettingsPersisterHelper settings = new SettingsPersisterHelper(blogPersister); | |
CredentialsDomain domain = new CredentialsDomain("name", "description", null, null); | |
BlogCredentials creds = new BlogCredentials(settings, domain); | |
Console.WriteLine("Blog: {0}", blogPersister.Get("BlogName")); | |
Console.WriteLine("Username: {0}", creds.Username); | |
Console.WriteLine("Password: {0}", creds.Password); | |
Console.WriteLine(); | |
} | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment