2010-11-29 8 views
0

だから、私はscodeを12回実行していましたが、それは機能しました。 今は動作しません。私は、ログインしているアカウントの広告サーバーに対するある種の許可を前提にしていますが、その動作はまだ困惑しています。c#Active Directory ....ルート直下のOUを作成するときの奇妙さ

はここにコード

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; 
} 

この部分がちょうど

JCDCDirectoryEntry newOrgUnit = new JCDCDirectoryEntry(g, BuildType.distinguishedName, ADManager); 

名前でOU「センター」の検索を行いますされ、それがそのラインに当たるまで、すべてがその行、その後、エラーなしで実行されますそのようなオブジェクトがサーバー上に存在しないことを示します。

私はLDAPブラウザを見ています。はい、Centers OUは存在しません。

しかし、それは権限のことだ場合、なぜそれがこのビットに投げると、エラーはありません...

DirectoryEntry g = ADEntry.Children.Add("ou=" + organizationalUnit, "organizationalUnit"); 
g.Properties[ "description" ].Value = description; 

// Commit the new organizationalUnit to the directory. 
g.CommitChanges(); 

は、それが(CommitChangesを上のエラーをスローしてはいけません)。 ?

このコードが動作しなくなるために何が変更された可能性がありますか? 同じユーザーがツリーを削除していますので、少なくとも何かを行う権限があります。

私はこの同じコードを、同じドメインで先にテストしています。

ご迷惑をおかけして申し訳ございません。

答えて

0

Sigh、

私はマシンを再起動し、agianを起動しました。

申し訳ありません。

cal-

+0

Jes、私はもっと怖いです。 – kenny

関連する問題