First follow the steps to create a console application for working with SharePoint 2007 Social Computing features
Now that you have your application ready to go you can display users that already have a MySite using the code below.
Display Users that have a MySite
//Get the site associated with the users
using (SPSite spSite = new SPSite(@http://localhost))
//Create the server context because you are in a console application
ServerContext siteContext = ServerContext.GetContext(spSite);
UserProfileManager pmManager = new UserProfileManager(siteContext);
foreach (UserProfile spUser in pmManager)
if (spUser.PersonalSite != null)
using(SPSite personalSite = spUser.PersonalSite)
//Use SPSite like a normal site
Console.WriteLine("personalSite.Url: " + personalSite.Url);
You can see that once you have the site you could use it to check document libraries or any other action you would perform on an SPSite.
For an in-depth look at the API and programmatically using the Social Computing features of SharePoint 2007 check out chapter 8 of Professional SharePoint 2007 Development