TestimoX

API Reference

Class

DirectoryObjectHelper

Namespace ADPlayground
Assembly ADPlayground
Modifiers sealed

Provides strongly typed single-object read and property-update operations for user, group, computer, and OU objects.

Inheritance

  • Object
  • DirectoryObjectHelper

Constructors

public DirectoryObjectHelper(Func<DirectoryManagedObjectType, String, String, IReadOnlyList<String>, DirectoryObjectSnapshot> getObject = null, Func<DirectoryManagedObjectType, String, DirectoryObjectUpdate, String, DirectoryMutationResult> setObject = null, Func<String, Int32, GroupParentResult> resolveUserParentGroups = null, Func<String, Int32, GroupMembershipResult> resolveGroupMembers = null, Func<IReadOnlyList<String>> enumerateForestDomains = null) #

Initializes a new instance of the DirectoryObjectHelper class.

Parameters

getObject System.Func{ADPlayground.DirectoryManagedObjectType,System.String,System.String,System.Collections.Generic.IReadOnlyList{System.String},ADPlayground.DirectoryObjectSnapshot} = null optionalposition: 0
Optional getter override for testing.
setObject System.Func{ADPlayground.DirectoryManagedObjectType,System.String,ADPlayground.DirectoryObjectUpdate,System.String,ADPlayground.DirectoryMutationResult} = null optionalposition: 1
Optional setter override for testing.
resolveUserParentGroups System.Func{System.String,System.Int32,ADPlayground.GroupParentResult} = null optionalposition: 2
Optional recursive user-group resolver override for testing.
resolveGroupMembers System.Func{System.String,System.Int32,ADPlayground.GroupMembershipResult} = null optionalposition: 3
Optional recursive group-member resolver override for testing.
enumerateForestDomains System.Func{System.Collections.Generic.IReadOnlyList{System.String}} = null optionalposition: 4
Optional forest domain enumeration override for testing and advanced matching scenarios.

Methods

public IReadOnlyList<DirectoryObjectSnapshot> FindComputerMatches(String identity, IEnumerable<String> domainNames = null, IEnumerable<String> attributes = null, Boolean includeForestDomains = false) #
Returns: IReadOnlyList<DirectoryObjectSnapshot>

Finds computer objects by identity across one or more domains.

Parameters

identity System.String requiredposition: 0
Computer identity (sAMAccountName, dNSHostName, DN, name).
domainNames System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 1
Optional explicit domain DNS names to search.
attributes System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 2
Optional additional LDAP attributes.
includeForestDomains System.Boolean = false optionalposition: 3
When true and domainNames is not supplied, searches all domains returned by forest enumeration.

Returns

All matching computer snapshots across selected domains; empty when nothing matches.

public IReadOnlyList<DirectoryObjectSnapshot> FindGroupMatches(String identity, IEnumerable<String> domainNames = null, IEnumerable<String> attributes = null, Boolean includeForestDomains = false) #
Returns: IReadOnlyList<DirectoryObjectSnapshot>

Finds group objects by identity across one or more domains.

Parameters

identity System.String requiredposition: 0
Group identity (sAMAccountName, DN, mail, name).
domainNames System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 1
Optional explicit domain DNS names to search.
attributes System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 2
Optional additional LDAP attributes.
includeForestDomains System.Boolean = false optionalposition: 3
When true and domainNames is not supplied, searches all domains returned by forest enumeration.

Returns

All matching group snapshots across selected domains; empty when nothing matches.

public IReadOnlyList<DirectoryObjectSnapshot> FindOrganizationalUnitMatches(String identity, IEnumerable<String> domainNames = null, IEnumerable<String> attributes = null, Boolean includeForestDomains = false) #
Returns: IReadOnlyList<DirectoryObjectSnapshot>

Finds organizational unit objects by identity across one or more domains.

Parameters

identity System.String requiredposition: 0
OU identity (DN, ou, or name).
domainNames System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 1
Optional explicit domain DNS names to search.
attributes System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 2
Optional additional LDAP attributes.
includeForestDomains System.Boolean = false optionalposition: 3
When true and domainNames is not supplied, searches all domains returned by forest enumeration.

Returns

All matching organizational unit snapshots across selected domains; empty when nothing matches.

public IReadOnlyList<DirectoryObjectSnapshot> FindUserMatches(String identity, IEnumerable<String> domainNames = null, IEnumerable<String> attributes = null, Boolean includeForestDomains = false) #
Returns: IReadOnlyList<DirectoryObjectSnapshot>

Finds user objects by identity across one or more domains.

Parameters

identity System.String requiredposition: 0
User identity (sAMAccountName, UPN, DN, mail, name).
domainNames System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 1
Optional explicit domain DNS names to search.
attributes System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 2
Optional additional LDAP attributes.
includeForestDomains System.Boolean = false optionalposition: 3
When true and domainNames is not supplied, searches all domains returned by forest enumeration.

Returns

All matching user snapshots across selected domains; empty when nothing matches.

public DirectoryObjectSnapshot GetComputer(String identity, String domainName = null, IEnumerable<String> attributes = null) #
Returns: DirectoryObjectSnapshot

Gets one computer object by identity.

Parameters

identity System.String requiredposition: 0
Computer identity (sAMAccountName, dNSHostName, DN, name).
domainName System.String = null optionalposition: 1
Optional domain DNS name. When omitted, this method resolves a single domain context from identity hints (DN, UPN suffix, down-level DOMAIN\name) and then falls back to current machine context.
attributes System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 2
Optional additional LDAP attributes.

Returns

Typed computer snapshot.

public DirectoryObjectSnapshot GetGroup(String identity, String domainName = null, IEnumerable<String> attributes = null) #
Returns: DirectoryObjectSnapshot

Gets one group object by identity.

Parameters

identity System.String requiredposition: 0
Group identity (sAMAccountName, DN, mail, name).
domainName System.String = null optionalposition: 1
Optional domain DNS name. When omitted, this method resolves a single domain context from identity hints (DN, UPN suffix, down-level DOMAIN\name) and then falls back to current machine context.
attributes System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 2
Optional additional LDAP attributes.

Returns

Typed group snapshot.

public DirectoryGroupMembersSnapshot GetGroupMembers(String identity, String domainName = null, Boolean recursive = false, Int32 maxDepth = 256) #
Returns: DirectoryGroupMembersSnapshot

Gets direct group members and, optionally, recursively resolved nested memberships.

Parameters

identity System.String requiredposition: 0
Group identity (sAMAccountName, DN, mail, name).
domainName System.String = null optionalposition: 1
Optional domain DNS name. When omitted, domain is inferred from identity hints before falling back to current machine context.
recursive System.Boolean = false optionalposition: 2
When set, resolves recursive members via membership resolver.
maxDepth System.Int32 = 256 optionalposition: 3
Maximum recursion depth used when resolving recursive members.

Returns

Typed group-membership snapshot.

public DirectoryObjectSnapshot GetOrganizationalUnit(String identity, String domainName = null, IEnumerable<String> attributes = null) #
Returns: DirectoryObjectSnapshot

Gets one organizational unit object by identity.

Parameters

identity System.String requiredposition: 0
OU identity (DN, ou, or name).
domainName System.String = null optionalposition: 1
Optional domain DNS name. When omitted, this method resolves a single domain context from identity hints (primarily DN) and then falls back to current machine context.
attributes System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 2
Optional additional LDAP attributes.

Returns

Typed organizational unit snapshot.

public static IReadOnlyList<String> GetReadOnlyAttributeDenylist() #
Returns: IReadOnlyList<String>

Gets the read-only LDAP attribute denylist enforced by directory object write operations.

Returns

Canonical read-only attribute names sorted alphabetically.

public DirectoryObjectSnapshot GetUser(String identity, String domainName = null, IEnumerable<String> attributes = null) #
Returns: DirectoryObjectSnapshot

Gets one user object by identity.

Parameters

identity System.String requiredposition: 0
User identity (sAMAccountName, UPN, DN, mail, name).
domainName System.String = null optionalposition: 1
Optional domain DNS name. When omitted, this method resolves a single domain context from identity hints (DN, UPN suffix, down-level DOMAIN\name) and then falls back to current machine context.
attributes System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 2
Optional additional LDAP attributes.

Returns

Typed user snapshot.

public DirectoryUserGroupsSnapshot GetUserGroups(String identity, String domainName = null, Boolean recursive = false, Int32 maxDepth = 256) #
Returns: DirectoryUserGroupsSnapshot

Gets direct user group memberships and, optionally, recursive parent groups.

Parameters

identity System.String requiredposition: 0
User identity (sAMAccountName, UPN, DN, mail, name).
domainName System.String = null optionalposition: 1
Optional domain DNS name. When omitted, domain is inferred from identity hints before falling back to current machine context.
recursive System.Boolean = false optionalposition: 2
When set, resolves recursive parent groups via membership resolver.
maxDepth System.Int32 = 256 optionalposition: 3
Maximum recursion depth used when resolving recursive groups.

Returns

Typed user-group membership snapshot.

public DirectoryMutationResult SetComputer(String identity, DirectoryObjectUpdate update, String domainName = null) #
Returns: DirectoryMutationResult

Updates a computer object.

Parameters

identity System.String requiredposition: 0
Computer identity (sAMAccountName, dNSHostName, DN, name).
update ADPlayground.DirectoryObjectUpdate requiredposition: 1
Typed and custom attribute update definition.
domainName System.String = null optionalposition: 2
Optional domain DNS name. When omitted, domain is inferred from identity hints before falling back to current machine context.

Returns

Mutation result details.

public DirectoryMutationResult SetGroup(String identity, DirectoryObjectUpdate update, String domainName = null) #
Returns: DirectoryMutationResult

Updates a group object.

Parameters

identity System.String requiredposition: 0
Group identity (sAMAccountName, DN, mail, name).
update ADPlayground.DirectoryObjectUpdate requiredposition: 1
Typed and custom attribute update definition.
domainName System.String = null optionalposition: 2
Optional domain DNS name. When omitted, domain is inferred from identity hints before falling back to current machine context.

Returns

Mutation result details.

public DirectoryMutationResult SetOrganizationalUnit(String identity, DirectoryObjectUpdate update, String domainName = null) #
Returns: DirectoryMutationResult

Updates an organizational unit object.

Parameters

identity System.String requiredposition: 0
OU identity (DN, ou, or name).
update ADPlayground.DirectoryObjectUpdate requiredposition: 1
Typed and custom attribute update definition.
domainName System.String = null optionalposition: 2
Optional domain DNS name. When omitted, domain is inferred from identity hints before falling back to current machine context.

Returns

Mutation result details.

public DirectoryMutationResult SetUser(String identity, DirectoryObjectUpdate update, String domainName = null) #
Returns: DirectoryMutationResult

Updates a user object.

Parameters

identity System.String requiredposition: 0
User identity (sAMAccountName, UPN, DN, mail, name).
update ADPlayground.DirectoryObjectUpdate requiredposition: 1
Typed and custom attribute update definition.
domainName System.String = null optionalposition: 2
Optional domain DNS name. When omitted, domain is inferred from identity hints before falling back to current machine context.

Returns

Mutation result details.