149 references to DirectoryContextType
System.DirectoryServices (146)
System\DirectoryServices\ActiveDirectory\ActiveDirectorySchema.cs (12)
92
if ((context.ContextType !=
DirectoryContextType
.Forest) &&
93
(context.ContextType !=
DirectoryContextType
.ConfigurationSet) &&
94
(context.ContextType !=
DirectoryContextType
.DirectoryServer))
109
if (context.ContextType ==
DirectoryContextType
.Forest)
113
else if (context.ContextType ==
DirectoryContextType
.ConfigurationSet)
146
if (context.ContextType ==
DirectoryContextType
.Forest)
150
else if (context.ContextType ==
DirectoryContextType
.ConfigurationSet)
166
if (context.ContextType ==
DirectoryContextType
.ConfigurationSet)
383
return ActiveDirectorySchema.GetSchema(new DirectoryContext(
DirectoryContextType
.Forest));
520
DirectoryContext adamInstContext = Utils.GetNewDirectoryContext(adamInstName,
DirectoryContextType
.DirectoryServer, context);
533
DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName,
DirectoryContextType
.DirectoryServer, context);
540
DirectoryContext adamInstContext = Utils.GetNewDirectoryContext(adamInstName,
DirectoryContextType
.DirectoryServer, context);
System\DirectoryServices\ActiveDirectory\ActiveDirectorySchemaClass.cs (1)
366
DirectoryContext schemaRoleOwnerContext = Utils.GetNewDirectoryContext(schemaRoleOwner.Name,
DirectoryContextType
.DirectoryServer, _context);
System\DirectoryServices\ActiveDirectory\ActiveDirectorySchemaProperty.cs (1)
408
DirectoryContext schemaRoleOwnerContext = Utils.GetNewDirectoryContext(schemaRoleOwner.Name,
DirectoryContextType
.DirectoryServer, _context);
System\DirectoryServices\ActiveDirectory\ActiveDirectorySite.cs (12)
193
new DirectoryContext(
DirectoryContextType
.Forest);
215
DirectoryContext currentContext = Utils.GetNewDirectoryContext(forestName,
DirectoryContextType
.Forest, null);
396
_topologyGenerator = new AdamInstance(Utils.GetNewDirectoryContext(fullHostName,
DirectoryContextType
.DirectoryServer, context), fullHostName);
400
_topologyGenerator = new DomainController(Utils.GetNewDirectoryContext(hostname,
DirectoryContextType
.DirectoryServer, context), hostname!);
1058
replica = new AdamInstance(Utils.GetNewDirectoryContext(fullhost,
DirectoryContextType
.DirectoryServer, context), fullhost);
1062
replica = new DomainController(Utils.GetNewDirectoryContext(host,
DirectoryContextType
.DirectoryServer, context), host);
1302
DomainController dc = DomainController.GetDomainController(Utils.GetNewDirectoryContext(serverName,
DirectoryContextType
.DirectoryServer, context));
1343
Domain domain = new Domain(Utils.GetNewDirectoryContext(d,
DirectoryContextType
.Domain, context), d);
1410
replica = new AdamInstance(Utils.GetNewDirectoryContext(fullHostName,
DirectoryContextType
.DirectoryServer, context), fullHostName);
1413
replica = new DomainController(Utils.GetNewDirectoryContext(hostName,
DirectoryContextType
.DirectoryServer, context), hostName);
1475
replica = new AdamInstance(Utils.GetNewDirectoryContext(fullHostName,
DirectoryContextType
.DirectoryServer, context), fullHostName);
1478
replica = new DomainController(Utils.GetNewDirectoryContext(hostName,
DirectoryContextType
.DirectoryServer, context), hostName);
System\DirectoryServices\ActiveDirectory\ADAMInstance.cs (4)
120
if (context.ContextType !=
DirectoryContextType
.DirectoryServer)
170
if (context.ContextType !=
DirectoryContextType
.ConfigurationSet)
196
if (context.ContextType !=
DirectoryContextType
.ConfigurationSet)
489
DirectoryContext configSetContext = Utils.GetNewDirectoryContext(Name,
DirectoryContextType
.DirectoryServer, context);
System\DirectoryServices\ActiveDirectory\ApplicationPartition.cs (9)
113
if (context.ContextType !=
DirectoryContextType
.ApplicationPartition)
277
if (context.ContextType ==
DirectoryContextType
.DirectoryServer)
333
appNCContext = Utils.GetNewDirectoryContext(serverName,
DirectoryContextType
.DirectoryServer, context);
339
appNCContext = Utils.GetNewDirectoryContext(adamInstName,
DirectoryContextType
.DirectoryServer, context);
663
DirectoryContext fsmoContext = Utils.GetNewDirectoryContext(GetNamingRoleOwner(),
DirectoryContextType
.DirectoryServer, context);
922
this.context = Utils.GetNewDirectoryContext(serverDnsName,
DirectoryContextType
.DirectoryServer, context);
1026
DirectoryContext roleOwnerContext = Utils.GetNewDirectoryContext(namingFsmoName,
DirectoryContextType
.DirectoryServer, context);
1181
DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName,
DirectoryContextType
.DirectoryServer, context);
1203
DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName,
DirectoryContextType
.DirectoryServer, context);
System\DirectoryServices\ActiveDirectory\ConfigSet.cs (11)
79
if ((context.ContextType !=
DirectoryContextType
.ConfigurationSet) &&
80
(context.ContextType !=
DirectoryContextType
.DirectoryServer))
89
if (context.ContextType ==
DirectoryContextType
.ConfigurationSet)
125
if (context.ContextType ==
DirectoryContextType
.ConfigurationSet)
141
if (context.ContextType ==
DirectoryContextType
.ConfigurationSet)
343
if (forestContext.ContextType ==
DirectoryContextType
.DirectoryServer)
380
if (context.ContextType !=
DirectoryContextType
.ConfigurationSet)
516
DirectoryContext adamInstContext = Utils.GetNewDirectoryContext(adamInstanceName,
DirectoryContextType
.DirectoryServer, context);
540
DirectoryContext adamInstContext = Utils.GetNewDirectoryContext(adamInstanceName,
DirectoryContextType
.DirectoryServer, context);
617
DirectoryContext adamInstContext = Utils.GetNewDirectoryContext(adamInstName,
DirectoryContextType
.DirectoryServer, _context);
712
DirectoryContext appNCContext = Utils.GetNewDirectoryContext(replicaName,
DirectoryContextType
.DirectoryServer, _context);
System\DirectoryServices\ActiveDirectory\DirectoryContext.cs (43)
27
private
DirectoryContextType
_contextType;
48
internal void InitializeDirectoryContext(
DirectoryContextType
contextType, string? name, string? username, string? password)
63
internal DirectoryContext(
DirectoryContextType
contextType, string? name, DirectoryContext? context)
89
if (context.ContextType !=
DirectoryContextType
.ConfigurationSet)
103
public DirectoryContext(
DirectoryContextType
contextType)
109
if (contextType !=
DirectoryContextType
.Domain && contextType !=
DirectoryContextType
.Forest)
117
public DirectoryContext(
DirectoryContextType
contextType, string name)
119
if (contextType <
DirectoryContextType
.Domain || contextType >
DirectoryContextType
.ApplicationPartition)
121
throw new InvalidEnumArgumentException(nameof(contextType), (int)contextType, typeof(
DirectoryContextType
));
134
public DirectoryContext(
DirectoryContextType
contextType, string? username, string? password)
140
if (contextType !=
DirectoryContextType
.Domain && contextType !=
DirectoryContextType
.Forest)
148
public DirectoryContext(
DirectoryContextType
contextType, string name, string? username, string? password)
150
if (contextType <
DirectoryContextType
.Domain || contextType >
DirectoryContextType
.ApplicationPartition)
152
throw new InvalidEnumArgumentException(nameof(contextType), (int)contextType, typeof(
DirectoryContextType
));
178
public
DirectoryContextType
ContextType => _contextType;
185
internal static bool IsContextValid(DirectoryContext context,
DirectoryContextType
contextType)
189
if ((contextType ==
DirectoryContextType
.Domain) || ((contextType ==
DirectoryContextType
.Forest) && (context.Name == null)))
246
else if (contextType ==
DirectoryContextType
.Forest)
294
else if (contextType ==
DirectoryContextType
.ApplicationPartition)
336
else if (contextType ==
DirectoryContextType
.DirectoryServer)
382
if (_contextType !=
DirectoryContextType
.Forest)
387
_contextIsValid = IsContextValid(this,
DirectoryContextType
.Forest);
395
if (_contextType !=
DirectoryContextType
.Domain)
400
_contextIsValid = IsContextValid(this,
DirectoryContextType
.Domain);
408
if (_contextType !=
DirectoryContextType
.ApplicationPartition)
413
_contextIsValid = IsContextValid(this,
DirectoryContextType
.ApplicationPartition);
421
if (_contextType !=
DirectoryContextType
.DirectoryServer)
426
_contextIsValid = IsContextValid(this,
DirectoryContextType
.DirectoryServer);
434
if (_contextType !=
DirectoryContextType
.ConfigurationSet)
439
_contextIsValid = IsContextValid(this,
DirectoryContextType
.ConfigurationSet);
481
return ((ContextType ==
DirectoryContextType
.DirectoryServer) || (ContextType ==
DirectoryContextType
.ConfigurationSet));
490
case
DirectoryContextType
.ConfigurationSet:
503
case
DirectoryContextType
.Domain:
504
case
DirectoryContextType
.Forest:
511
if ((_name == null) || ((_contextType ==
DirectoryContextType
.Forest) && (isCurrentForest())))
521
case
DirectoryContextType
.ApplicationPartition:
529
case
DirectoryContextType
.DirectoryServer:
System\DirectoryServices\ActiveDirectory\DirectoryServer.cs (5)
703
DirectoryContext newContext = Utils.GetNewDirectoryContext(sourceServer,
DirectoryContextType
.DirectoryServer, context);
763
DirectoryContext newContext = Utils.GetNewDirectoryContext(Name,
DirectoryContextType
.DirectoryServer, context);
768
DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name,
DirectoryContextType
.DirectoryServer, context), srchDN);
806
DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name,
DirectoryContextType
.DirectoryServer, context), siteName);
815
DirectoryContext newContext = Utils.GetNewDirectoryContext(Name,
DirectoryContextType
.DirectoryServer, context);
System\DirectoryServices\ActiveDirectory\Domain.cs (12)
68
if ((context.ContextType !=
DirectoryContextType
.Domain) &&
69
(context.ContextType !=
DirectoryContextType
.DirectoryServer))
84
if (context.ContextType ==
DirectoryContextType
.Domain)
118
if (context.ContextType ==
DirectoryContextType
.Domain)
145
return Domain.GetDomain(new DirectoryContext(
DirectoryContextType
.Domain, computerDomainName));
673
DirectoryContext targetContext = Utils.GetNewDirectoryContext(targetDomainName,
DirectoryContextType
.Domain, context);
813
return Domain.GetDomain(new DirectoryContext(
DirectoryContextType
.Domain));
831
DirectoryContext forestContext = Utils.GetNewDirectoryContext(forestName,
DirectoryContextType
.Forest, context);
1074
DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName,
DirectoryContextType
.DirectoryServer, context);
1150
domainContext = Utils.GetNewDirectoryContext(parentDomainName,
DirectoryContextType
.Domain, context);
1210
DirectoryContext childContext = Utils.GetNewDirectoryContext(childDomainName,
DirectoryContextType
.Domain, context);
1389
DirectoryContext tmpContext = Utils.GetNewDirectoryContext(context.Name,
DirectoryContextType
.Forest, context);
System\DirectoryServices\ActiveDirectory\DomainController.cs (11)
131
if (context.ContextType !=
DirectoryContextType
.DirectoryServer)
178
if (context.ContextType !=
DirectoryContextType
.Domain)
190
if (context.ContextType !=
DirectoryContextType
.Domain)
204
if (context.ContextType !=
DirectoryContextType
.Domain)
216
if (context.ContextType !=
DirectoryContextType
.Domain)
230
if (context.ContextType !=
DirectoryContextType
.Domain)
245
if (context.ContextType !=
DirectoryContextType
.Domain)
589
DirectoryContext forestContext = Utils.GetNewDirectoryContext(Name,
DirectoryContextType
.DirectoryServer, context);
709
DirectoryContext domainContext = Utils.GetNewDirectoryContext(Name,
DirectoryContextType
.DirectoryServer, context);
998
DirectoryContext dcContext = Utils.GetNewDirectoryContext(domainControllerName,
DirectoryContextType
.DirectoryServer, context);
1034
DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName,
DirectoryContextType
.DirectoryServer, context);
System\DirectoryServices\ActiveDirectory\Forest.cs (11)
95
if ((context.ContextType !=
DirectoryContextType
.Forest) &&
96
(context.ContextType !=
DirectoryContextType
.DirectoryServer))
111
if (context.ContextType ==
DirectoryContextType
.Forest)
144
if (context.ContextType ==
DirectoryContextType
.Forest)
485
DirectoryContext targetContext = Utils.GetNewDirectoryContext(targetForestName,
DirectoryContextType
.Forest, _context);
620
public static Forest GetCurrentForest() => GetForest(new DirectoryContext(
DirectoryContextType
.Forest));
708
DirectoryContext domainContext = Utils.GetNewDirectoryContext(Name,
DirectoryContextType
.Domain, _context);
829
DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName,
DirectoryContextType
.DirectoryServer, _context);
971
DirectoryContext appNCContext = Utils.GetNewDirectoryContext(dnsName,
DirectoryContextType
.ApplicationPartition, _context);
1026
DirectoryContext domainContext = Utils.GetNewDirectoryContext(domainName,
DirectoryContextType
.Domain, _context);
1047
if (_context.ContextType ==
DirectoryContextType
.DirectoryServer)
System\DirectoryServices\ActiveDirectory\GlobalCatalog.cs (10)
39
if (context.ContextType !=
DirectoryContextType
.DirectoryServer)
93
if (context.ContextType !=
DirectoryContextType
.Forest)
105
if (context.ContextType !=
DirectoryContextType
.Forest)
119
if (context.ContextType !=
DirectoryContextType
.Forest)
131
if (context.ContextType !=
DirectoryContextType
.Forest)
145
if (context.ContextType !=
DirectoryContextType
.Forest)
160
if (context.ContextType !=
DirectoryContextType
.Forest)
238
_ = Utils.GetNewDirectoryContext(Name,
DirectoryContextType
.DirectoryServer, context);
401
DirectoryContext gcContext = Utils.GetNewDirectoryContext(globalCatalogName,
DirectoryContextType
.DirectoryServer, context);
417
DirectoryContext gcContext = Utils.GetNewDirectoryContext(gcName,
DirectoryContextType
.DirectoryServer, context);
System\DirectoryServices\ActiveDirectory\Locator.cs (1)
112
DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName,
DirectoryContextType
.DirectoryServer, context);
System\DirectoryServices\ActiveDirectory\Utils.cs (3)
591
internal static DirectoryContext GetNewDirectoryContext(string? name,
DirectoryContextType
contextType, DirectoryContext? context)
1039
if (context.ContextType ==
DirectoryContextType
.DirectoryServer)
1283
DirectoryContext fsmoContext = Utils.GetNewDirectoryContext(fsmoRoleOwnerName,
DirectoryContextType
.DirectoryServer, context);
System.DirectoryServices.AccountManagement (3)
System\DirectoryServices\AccountManagement\AD\ADStoreCtx.cs (2)
1192
Forest forest = Forest.GetForest(new DirectoryContext(
DirectoryContextType
.Forest, this.DnsForestName, this.credentials?.UserName, this.credentials?.Password));
1194
DirectoryContext dc = new DirectoryContext(
DirectoryContextType
.Domain, this.DnsDomainName, this.credentials?.UserName, this.credentials?.Password);
System\DirectoryServices\AccountManagement\AD\ADUtils.cs (1)
477
Domain targetdom = Domain.GetDomain(new DirectoryContext(
DirectoryContextType
.Domain, targetDomain, username, password));