API Reference
Class
LdapToolContextHelper
Reusable LDAP context/attribute resolution helpers for tool and wrapper layers.
Inheritance
- Object
- LdapToolContextHelper
Remarks
These helpers keep context and attribute-selection policy in ADPlayground so wrappers can stay thin.
Methods
public static IReadOnlyList<String> ResolveAttributeList(IEnumerable<String> requestedAttributes, IEnumerable<String> allowedAttributes, IEnumerable<String> defaultAttributes, IEnumerable<String> requiredAttributes, Nullable<Int32> maxAttributeCount = null) #Returns:
IReadOnlyList<String>Resolves an attribute list in stable order using: requested + defaults + required (with optional allowlist and optional max cap).
Parameters
- requestedAttributes System.Collections.Generic.IEnumerable{System.String}
- User-requested attributes (first precedence in output order).
- allowedAttributes System.Collections.Generic.IEnumerable{System.String}
- Optional allowlist; when provided, requested/default attributes outside this set are ignored.
- defaultAttributes System.Collections.Generic.IEnumerable{System.String}
- Default attributes appended after requested attributes.
- requiredAttributes System.Collections.Generic.IEnumerable{System.String}
- Required attributes always appended at the end if missing.
- maxAttributeCount System.Nullable{System.Int32} = null
- Optional cap applied to non-required attributes only. Clamped to MaxAttributesCap.
Returns
Ordered, deduplicated attribute list.
public static LdapSearchContext ResolveSearchContext(String explicitDomainController, String explicitBaseDn, String defaultDomainController, String defaultBaseDn, CancellationToken cancellationToken = null) #Returns:
LdapSearchContextResolves effective domain controller and base DN using: explicit arguments -> tool defaults -> RootDSE defaultNamingContext.
Parameters
- explicitDomainController System.String
- Explicit domain controller argument.
- explicitBaseDn System.String
- Explicit base DN argument.
- defaultDomainController System.String
- Tool default domain controller.
- defaultBaseDn System.String
- Tool default base DN.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token used during RootDSE reads.
Returns
Resolved LDAP search context.
Exceptions
InvalidOperationException– Thrown when neither explicit nor default base DN is provided and RootDSE does not return defaultNamingContext.