[英]c# Active Directory… weirdness when creating a OU just under the root
So, I've run thi scode a dozen times and it worked, now it's not working. 因此,我已经运行了十次该编码,并且该编码正常工作,但现在不起作用。 I'm assuming its some kind of permission on the ad server for the account that's logged in, but the behavior is still puzzling. 我假设已登录帐户在广告服务器上具有某种权限,但这种行为仍然令人困惑。
here is the code 这是代码
public JCDCDirectoryEntry CreateOrgUnit( string organizationalUnit, string description, ADS_GROUP_TYPE type )
{
log.Debug( GetMethodNameAndParms() + " - in" );
// Bind to the domain that this user is currently connected to.
DirectoryEntry g = ADEntry.Children.Add( "ou=" + organizationalUnit, "organizationalUnit" );
g.Properties[ "description" ].Value = description;
// Commit the new organizationalUnit to the directory.
g.CommitChanges();
JCDCDirectoryEntry newOrgUnit = new JCDCDirectoryEntry( g, BuildType.distinguishedName, ADManager );
g.Close();
return newOrgUnit;
}
this part just does a search for the OU "Centers" by name 这部分只是按名称搜索OU“中心”
JCDCDirectoryEntry newOrgUnit = new JCDCDirectoryEntry( g, BuildType.distinguishedName, ADManager );
everything runs with no errors till it hits that line, then that line says no such object exists on the server. 一切正常,直到命中该行为止,然后该行表明服务器上不存在此类对象。
I go look in the LDAP browser,and yes, the Centers OU does not exist. 我去看一下LDAP浏览器,是的,Centers OU不存在。
But if it's a permissions thing, why does it not throw and error on this bit... 但是,如果这是权限的事情,为什么它不抛出错误呢?
DirectoryEntry g = ADEntry.Children.Add( "ou=" + organizationalUnit, "organizationalUnit" );
g.Properties[ "description" ].Value = description;
// Commit the new organizationalUnit to the directory.
g.CommitChanges();
Shouldn't it throw an error on CommitChanges(); 它不应该在CommitChanges()上引发错误吗? ? ?
Anyone have any idea what could have changed to make this code stop working? 任何人都知道为了使此代码停止工作可能进行了哪些更改? the same user deleted the tree, so it's got permissions to do at least somethings... 相同的用户删除了该树,因此它至少有权执行某些操作...
I used this same code, at least a dozen times testing earlier on this same domain, say a month ago. 我使用了相同的代码,至少一个月前在相同的域上进行了至少十多次测试。
Any help or hint is greatly appreciated. 任何帮助或提示,我们将不胜感激。
Sigh, 叹,
I rebooted my machine and it started working agian. 我重启了机器,开始使用agian。
Sorry Everyone. 对不起,大家。
Cal- Cal-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.