EasyAD 1.0.1
dotnet add package EasyAD --version 1.0.1
NuGet\Install-Package EasyAD -Version 1.0.1
<PackageReference Include="EasyAD" Version="1.0.1" />
paket add EasyAD --version 1.0.1
#r "nuget: EasyAD, 1.0.1"
// Install EasyAD as a Cake Addin #addin nuget:?package=EasyAD&version=1.0.1 // Install EasyAD as a Cake Tool #tool nuget:?package=EasyAD&version=1.0.1
EasyAD
An easy way to interact with an Active Directory directly from your source. IMPORTANT: ldaps might not work at the moment, since it´s not fully tested. I am assuming, that you´re the admin of this AD instance and you know what you are doing. I am absolutely not responsible for any errors or unexpected user deletion or something like that.
Implement EasyAD
After loading the nuget package the implementation is quite simple. Simply create a handler object to interact with the Active Directory instance.
ADHandler handler = new ADHandler(ldapPath, ldapAdmin, ldapAdminPassWord, domainName, container);
The params from first to last are meaning the following:
{string} ldapPath:
The LDAP path of your AD instance. Be sure to send it with ldap:// and the ip or the domain of your AD instance. Be sure to make it reachable over the network, if you plan to connect your AD not from localhost
{string} ldapAdmin:
The username of your AD administrator or at least a user which has admin rights (If you have problems, connecting your AD, try to give the complete username like admin@example.com)
{string} ldapAdminPassWord:
The password of the given admin user account.
{string} domainName:
The domain name of the AD you want to interact with. For example this can be EXAMPLE.com (be sure to fit upper and lower case like in your AD)
{string} container:
The complete ldap connection string. This should fit your AD sections. For example this can be CN=Users,DC=EXAMPLE,DC=com
Interacting with the ADHandler object.
As the name of the library says, it is very easy. I think every developer should be able to interpret what every available Method of an ADHandler object is able tol do. If you don´t ... feel free to contact me. IMHO only 1 method need a bit of further explanation.
Get specific values for an AD user
An AD user will be filled with the most "classic" attributes directly (like first name, surname, mail address and so) and stored into an ADUserDetail object. You can get a simple user with the handler or all users by using handler.GetAllDomainUsers(). But sometimes you want to know more than the classic attributes. You can also call the handler for that like I did it below.
var val = handler.GetSpecificPropertyForUser(detailUser,adProperty);
The params from first to last are meaning the following:
{ADUserDetail} detailUser:
The object for your AD user which you want to know further attributes. You might get this by handler.GetAllDomainUsers() and then picking one of the users which was returned into a list.
{enum ADProperty} adProperty:
The AD property value you want to get. As this is an implemented enumeration you just have to select, which one exactly you want to know. I named them all as they are named directly in Active Directory. They should be self explaining I think. As the enums are transformed in an own class called ADProperties, instantiate a new object of this class to take one of those enums. Be sure to call the method like this:
handler.GetSpecificPropertyForUser(adUserObject,new ADProperties().OBJECTCLASS);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 640 | 3/5/2019 |
Summary of changes made in this release of the package.