I am trying to include the “System.DirectoryServices.AccountManagement” package or import this reference into my process, but it gets failed. Someone please check and tell me how to import it without this failure notice.
I have tried it in two versions 2019.10 and 2019.4 in two different environments, it shows installed, But when you import the System.DorectoryServices.AccountManagement it will be not imported, Please check that as well.
And go back to the Manage package console and check once if you see anything highlighted for this package.
I am trying to get the user’s email address from Active Directory using their employee id, we can get it using " System.DirectoryServices.AccountManagement" dll, but with the above package I am not able to get it done.
The below code only I am trying to use,
Dim wi As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent()
Dim a As String() = wi.Name.Split(New Char() {"\"c}) '' Context.User.Identity.Name.Split('\')
Dim dc As PrincipalContext = New PrincipalContext(ContextType.Domain, "DomainName")
Dim adUser As UserPrincipal = UserPrincipal.FindByIdentity(dc, a(1))
Dim Email As String = adUser.EmailAddress