Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jongalloway
Created August 9, 2013 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jongalloway/5bdb10cb81318a2069fc to your computer and use it in GitHub Desktop.
Save jongalloway/5bdb10cb81318a2069fc to your computer and use it in GitHub Desktop.
Retrieve blog credentials using Windows Live Writer SDK. Source: blog comments here http://lozanotek.com/blog/archive/2007/07/22/Using_The_Windows_Live_Writer_API_To_Retrieve_Your_Blog_Password.aspx#27081
using System;
using Microsoft.Win32;
// Add a ref to C:\Program Files (x86)\Windows Live\Writer\WindowsLive.Writer.BlogClient.dll
using WindowsLive.Writer.BlogClient;
// Add a ref to C:\Program Files (x86)\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