This blog is moved to
http://amalhashim.wordpress.com

Friday, October 8, 2010

MOSS 2007 | Enumerate User Profile Properties

Below is the code to enumerate the User Profile Properties

using System;
using Microsoft.Office.Server;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://server:port/"))
{
ServerContext context =
ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
string sAccount = "domain\\user";
UserProfile u = profileManager.GetUserProfile(sAccount);
PropertyCollection props = profileManager.Properties;

foreach (Property prop in props)
{
Console.WriteLine(prop.DisplayName + ">>" + prop.Name );
}
}
}
}
}

No comments: