假设我希望实现一个扩展方法,它允许我为每个DirectoryEntry对象获取森林对象。
我的骨架代码:
public static Forest GetForest(DirectoryEntry de) {
string forestDnsName = //DoSomethingWith(de.Path); ?
DirectoryContext context = new DirectoryContext(DirectoryContextType.Forest, forestDnsName);
return Forest.GetForest(context)
}但我不知道我怎么能得到森林。有人知道怎么弄吗?
发布于 2015-01-22 15:43:49
没有示例代码,只是一些一般步骤:
Forest对象了。如果要多次调用此扩展方法,则可以将域名构建到Forest对象映射以减少AD通信量(跳过步骤4-7)。
https://stackoverflow.com/questions/28089361
复制相似问题