Get User Profile Property

The article demonstrates how to retrieve a User Profile property. Note that User Profile is only available in SharePoint 2007 and not WSS!

Reference
Microsoft.Office.Server (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.Office.Server.dll)

Code
ServerContext context = ServerContext.GetContext(SPContext.Current.Site); UserProfileManager manager = new UserProfileManager(context); // Get the user profile of the currently logged in user UserProfile profile = manager.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName); // Retrieve the 'Manager' property of the User Profile return profile[PropertyConstants.Manager].ToString;