Note that there are some explanatory texts on larger screens.

plurals
  1. POActive directory : get groups where a user is member
    primarykey
    data
    text
    <p>I'd like find the groups list where a user is member. I tried several solution from <a href="http://www.codeproject.com/KB/system/everythingInAD.aspx" rel="nofollow">http://www.codeproject.com/KB/system/everythingInAD.aspx</a> but no result.</p> <p>This code give me a "true", means LDAP is running : </p> <pre><code>public static bool Exists(string objectPath) { bool found = false; if (DirectoryEntry.Exists("LDAP://" + objectPath)) found = true; return found; } </code></pre> <p>Thanks,</p> <p><strong>Update 1:</strong></p> <pre><code>public ArrayList Groups(string userDn, bool recursive) { ArrayList groupMemberships = new ArrayList(); return AttributeValuesMultiString("memberOf", "LDAP-Server", groupMemberships, recursive); } public ArrayList AttributeValuesMultiString(string attributeName, string objectDn, ArrayList valuesCollection, bool recursive) { DirectoryEntry ent = new DirectoryEntry(objectDn); PropertyValueCollection ValueCollection = ent.Properties[attributeName]; IEnumerator en = ValueCollection.GetEnumerator(); while (en.MoveNext()) { if (en.Current != null) { if (!valuesCollection.Contains(en.Current.ToString())) { valuesCollection.Add(en.Current.ToString()); if (recursive) { AttributeValuesMultiString(attributeName, "LDAP://" + en.Current.ToString(), valuesCollection, true); } } } } ent.Close(); ent.Dispose(); return valuesCollection; } </code></pre> <p>I have an exception on : </p> <pre><code>PropertyValueCollection ValueCollection = ent.Properties[attributeName]; </code></pre> <p>"COMException was unhandled"</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload