CHUVASH.eu

CHunky Universe of Vigourous Astonishing SHarepoint :)

Tag Archives: Domain

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).ToArray();
	var d = string.Join(",", dcParts); //dc=takana, dc=local
	Console.WriteLine(d);
}

First we get get the full domain, then we split and join them again.

Вула Чăвашла

VulaCV - Чăвашла вулаттаракан сайт

Discovering SharePoint

And going crazy doing it

Bram de Jager - Coder, Speaker, Author

Office 365, SharePoint and Azure

SharePoint Dragons

Nikander & Margriet on SharePoint

Paul J. Swider - RealActivity

RealActivity is a specialized Microsoft healthcare services and solution advisory firm.

Cameron Dwyer

Office 365, SharePoint, Azure, OnePlace Solutions & Life's Other Little Wonders

paul.tavares

Me and My doings!

Share SharePoint Points !

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

Aryan Nava

DevOps, Cloud and Blockchain Consultant

SPJoel

SharePoint for everyone

SharePointRyan

Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint

blksthl

Mostly what I know about SharePoint - CommunicoCuspis