Add LDAP member to LDAP group!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ilios78
    New Member
    • Mar 2008
    • 4

    Add LDAP member to LDAP group!

    Hi folks,
    I have been trying (in C# 2.0) using several ways to add an LDAP Member object to a group.

    Below you can see the code and two of the ways I tried:

    Code:
    DirectoryEntry newEntry; 
    
     //.....
     // Creating the LDAP member entry.....no problems here!!!
     //....
    
    using (DirectoryEntry groupEntry = GetGroupEntry())
    {                
            groupEntry.Properties["member"].Add(newEntry.Path);
            groupEntry.CommitChanges();   <-- Exception here
    }
    
    COMException: ex = {"The attribute type specified to the directory service is not defined. (Exception from HRESULT: 0x8007200C)"}
    I have also tried:
    groupEntry.Invo ke("Add", new object[] { newEntry.Path });
    In this case I get:
    "Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWN NAME))"
    right after the Invoke method!

    Any help or comment is most appricated!
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Seems to be a problem with newEntry.Path. What is its value?

    Comment

    • Ilios78
      New Member
      • Mar 2008
      • 4

      #3
      Originally posted by kenobewan
      Seems to be a problem with newEntry.Path. What is its value?
      The newEntry object is created and used with no problems!
      newEntry.Path = "LDAP://dev1:1003/cn=myuser1,ou=M embers,o=InMemb ership"

      Comment

      • kenobewan
        Recognized Expert Specialist
        • Dec 2006
        • 4871

        #4
        So you are trying to add the ldap query as a property of the group entry member?

        Comment

        • Ilios78
          New Member
          • Mar 2008
          • 4

          #5
          Originally posted by kenobewan
          So you are trying to add the ldap query as a property of the group entry member?
          Ok.. Is that wrong? What should I pass to the "add" method. Besides from the exception I get I think the group entry does not have a "member" property. Not that it does not understand the user entry object! But please let me know if you still think I am doing something wrong!

          Thanks

          Comment

          • kenobewan
            Recognized Expert Specialist
            • Dec 2006
            • 4871

            #6
            I thought that you would have wanted to add group properties such name. I don't believe the ldap query is a valid property of the group. HTH.

            Comment

            • Ilios78
              New Member
              • Mar 2008
              • 4

              #7
              Originally posted by kenobewan
              I thought that you would have wanted to add group properties such name. I don't believe the ldap query is a valid property of the group. HTH.
              The Path property is what uniquely defines an LDAP entry! I did try (just for being sure) passing the username and “name” property but as expected I got the same COM exception.

              Comment

              Working...