UserProfile profile;
SPServiceContext serviceContext = SPServiceContext.GetContext(SPContext.Current.Site);
string fromMail = string.Empty;
public void getEmailID()
{
try
{
UserProfileManager upm = new UserProfileManager(serviceContext);
profile = upm.GetUserProfile(currentUser.LoginName);
if (profile != null)
{
if (!string.IsNullOrEmpty(Convert.ToString(profile[PropertyConstants.WorkEmail].Value)))
{
fromMail = profile[PropertyConstants.WorkEmail].Value.ToString();
}
}
}
catch (Exception ex)
{
throw;
}
}
Using this UserProfileManger we can access all the details stored for a sharepoint user in User Profile Service Application.
thanks,
SPServiceContext serviceContext = SPServiceContext.GetContext(SPContext.Current.Site);
string fromMail = string.Empty;
public void getEmailID()
{
try
{
UserProfileManager upm = new UserProfileManager(serviceContext);
profile = upm.GetUserProfile(currentUser.LoginName);
if (profile != null)
{
if (!string.IsNullOrEmpty(Convert.ToString(profile[PropertyConstants.WorkEmail].Value)))
{
fromMail = profile[PropertyConstants.WorkEmail].Value.ToString();
}
}
}
catch (Exception ex)
{
throw;
}
}
Using this UserProfileManger we can access all the details stored for a sharepoint user in User Profile Service Application.
thanks,
No comments:
Post a Comment