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?
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; _site.RootWeb.Dispose(); _site.Dispose(); string managerName = (string)currentUserProfile["manager"].Value; SPFieldUserValue _spUserValue = new SPFieldUserValue(myWeb, managerName); SPUser myUser = _spUserValue.User;