views:

15

answers:

1

I am accessing the Active Directory to fetch the employee Id from the Directory Server from my ASP.Net MVC account using the below code.

I am able to get the Given Name,SurName and voice telephone number but not the Employee ID.But I know for sure that it is there.

I am developing in one machine and deploying in another so can I by some means authenticate from the code to the active directory and get the employee Id.what is the way to go about it?? Any HELP appreciated.

PrincipalContext context = new PrincipalContext(ContextType.Domain);
        UserPrincipal foundUser = UserPrincipal.FindByIdentity(context, "username");
        string employeeId = foundUser.EmployeeId;
A: 

The reason was because the active directory had the "employeeId" as a properties attribute.

yeshvan