Below you will find pages that utilize the taxonomy term “Domain”
Posts
Find the current Active Directory Domain
While working with Active Directory within SharePoint we probably don’t need to specify the domain or the root container. We can the current values. Here is a simple method from a console application just to demonstrate:
internal static void GetDomain() { var context = new DirectoryContext(DirectoryContextType.Domain); var domain = Domain.GetDomain(context); Console.WriteLine("Full domain:"); Console.WriteLine(domain.Name); //takana.local Console.WriteLine(); Console.WriteLine("root container"); var parts = domain.Name.Split(new\[\] {"."}, StringSplitOptions.RemoveEmptyEntries); var dcParts = parts.Select(n => "dc=" + n).