AurorisNet.ActiveDirectory
1.2.1
dotnet add package AurorisNet.ActiveDirectory --version 1.2.1
NuGet\Install-Package AurorisNet.ActiveDirectory -Version 1.2.1
<PackageReference Include="AurorisNet.ActiveDirectory" Version="1.2.1" />
<PackageVersion Include="AurorisNet.ActiveDirectory" Version="1.2.1" />
<PackageReference Include="AurorisNet.ActiveDirectory" />
paket add AurorisNet.ActiveDirectory --version 1.2.1
#r "nuget: AurorisNet.ActiveDirectory, 1.2.1"
#:package AurorisNet.ActiveDirectory@1.2.1
#addin nuget:?package=AurorisNet.ActiveDirectory&version=1.2.1
#tool nuget:?package=AurorisNet.ActiveDirectory&version=1.2.1
AurorisNet.ActiveDirectory
Wrappers over System.DirectoryServices for .NET 10 that read Active Directory users, groups,
computers and printers.
The package adds ADUser, ADGroup, ADComputer, ADPrinter and the DirectorySearch helper,
in the ActiveDirectory namespace. It runs on Windows, as an account that can read the
directory.
Install
dotnet add package AurorisNet.ActiveDirectory
AurorisNet.IdentityServer and AurorisNet.IdentityServer.Directory install this package as a
dependency.
Use
Read one user:
using System;
using ActiveDirectory;
using var user = new ADUser(@"EXAMPLE\alice");
Console.WriteLine(user.DisplayName);
Console.WriteLine(user.Email);
ADUser takes a SAM account name, a DOMAIN\user name or a full LDAP:// path, and throws
InvalidOperationException when it finds no such user. Dispose each wrapper when you are done
with it.
Search for users:
using ActiveDirectory;
var search = new DirectorySearch("LDAP://OU=Staff,DC=example,DC=com", ADObject.ObjectClass.User);
search.PropertiesToSearch.Add(ADProperties.User.Surname, "Smith", DirectorySearch.MatchType.StartsWith);
search.PropertiesToLoad.Add(ADProperties.User.DisplayName);
foreach (ADUser found in search.Find<ADUser>(25))
{
using (found) Console.WriteLine(found.DisplayName);
}
- A result holds only the attributes named in
PropertiesToLoad. Any other attribute reads as empty until you callBind()on the result, which opens a connection for it. PropertiesToSearchvalues are escaped.AdditionalFilteris raw LDAP: build it from trusted values only.Find<T>(howMany)limits the results. SetPageSizeto read more results than the domain controller returns in one page.
Related packages
AurorisNet.IdentityServer.Directorybuilds address-book searches, people pickers and group listings on this library.AurorisNet.IdentityServeris an OpenID Connect server for Active Directory, Samba AD and FreeIPA.
Documentation
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- System.DirectoryServices (>= 11.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on AurorisNet.ActiveDirectory:
| Package | Downloads |
|---|---|
|
AurorisNet.IdentityServer
Embeddable OpenID Connect server for ASP.NET Core, backed by Active Directory, Samba AD or FreeIPA. |
|
|
AurorisNet.IdentityServer.Directory
Active Directory people and group lookup for address books and people pickers: escaped, bounded searches, account lookups by SID, GUID or DOMAIN\user, and group listings, with application-supplied filters. |
GitHub repositories
This package is not used by any popular GitHub repositories.