Once the users are imported you can start accessing the user profiles. The following are the assmblies that will be used in order to achieve this
1. Microsoft.Office.Server
2. Micorsoft.Office.Server.UserProfiles
3. Microsoft.Office.Administration
4. And finally Microsoft.SharePoint
using (SPSite site = new SPSite(SSPsiteURL))
{
using (SPWeb web = site.OpenWeb())
{
UserProfileManager manager = new UserProfileManager(ServerContext.GetContext(web.site));
UserProfile profile = manager.GetUserProfile(web.CurrentUser.LoginName);
string deptName = profile["Department"].Value.ToString();
}
}
Department is a user profile property in ssp. Similarly you can access all the properties of a user from ssp
In order to iterate through all the user profiles in ssp, please go through my below post
Happy coding !
No comments:
Post a Comment