I want to send mail to selected user in people picker control and CC to the his manager. Able to send the email to user. But how to get his manager email Id in C# Web part? Basically How to distribute groups according to department and further users in group based on role like manager, developer, team lead and so on?

  • c# means do you want code sample in server side coding..?
    – TARUN
    Mar 24, 2017 at 8:01

2 Answers 2


1)You can maintain all manager's of employee in User Profile and can send mail from getting user profile properties of that employee.

2)Or you can maintain all details of employee in separate list an get the details from it.

for getting user profile you refer link


please check the below sharepoint stackexchange post Get Current User's Department Name and Manager From Active Directory. Instead of current user please pass the people or person column user identiy

 SPSite _site = SPContext.Current.Site;
   ServerContext serverContext = ServerContext.GetContext(_site);
   UserProfileManager myUserProfile = new UserProfileManager(serverContext);
   UserProfile currentUserProfile = myUserProfile .GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);

   string departmentName = (string)currentUserProfile["department"].Value;
   string managerName = (string)currentUserProfile["manager"].Value;
string managerName = (string)currentUserProfile["manager"].Value;    
SPFieldUserValue _spUserValue = new SPFieldUserValue(myWeb, managerName);    
SPUser myUser = _spUserValue.User;
  • thanks for reply, your answer may be great for those user who are using active directory.
    – Milan Raj
    Jun 15, 2017 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.