Sunita A

Sunita A

  • NA
  • 1
  • 4k

Need To retrive Manager Email Field from AD using C#

Jul 11 2013 2:03 PM
Hi All,
I would like to get the Manager Email field from the AD My code is as  follows:
Getting Manager E-Mail Id from AD Based on login User

                ////Get the username and domain information
                                    string userName = Environment.UserName;
                                    string domainName = Environment.UserDomainName;
               

                                    List<string> emailAddresses = new List<string>();
                                    PrincipalContext domainContext = new PrincipalContext(ContextType.Domain, domainName);
                                    UserPrincipal user = UserPrincipal.FindByIdentity(domainContext, userName);


I can retrived besic users attributes from AD but not manager email id field

Please help me


Thanks


Answers (2)