One last comment Joe, Do you think that is a bug with DSS? That now means depending of the attribute, you have to use different method? Kinda makes it complicated don't you think?. Now I have to "hard code" attribute names in my program. if attribute="description" do this else do it this way. That sucks Microsoft. Y
________________________________ From: [EMAIL PROTECTED] on behalf of Joe Kaplan Sent: Thu 28/12/2006 1:46 PM To: ActiveDir@mail.activedir.org Subject: Re: [ActiveDir] DirectoryServices vb.net is broken. I'm saying that those two are not equivalent functions under the hood. Add typically does a PutEx with the append flag, while Put just does a "put", which is essentially an LDAP "update" operation. I think you would have the same problem if you invoked PutEx and used the Append flag. .Value uses PutEx, but with the ADSI replace flag, which boils down to an LDAP update operation. Aren't all of the layers fun? :) You can dig into the details a little more by using Reflector to reverse compile System.DirectoryServices into your language of choice. That is how Ryan and I learned most of what we know. Figuring out how ADSI calls LDAP is pretty hard unless you have access to the Microsoft source code. Sorry if the example in 3.13 was at all misleading or inconsistent, but I'll stand by the more detailed stuff on attribute modification in Ch 6. Thanks for buying it and I hope it helps more than hurts. There is an inevitable amount of hair loss that must occur with any new LDAP programming project, but hopefully it won't require prescription drugs or surgery to replace. Joe K. ----- Original Message ----- From: "AD" <[EMAIL PROTECTED]> To: <ActiveDir@mail.activedir.org> Sent: Thursday, December 28, 2006 12:06 PM Subject: RE: [ActiveDir] DirectoryServices vb.net is broken. It worked. Thanks a million. Hopefully my hair won't take to long to grow back. I bought your book last week from amazon. I currently reading chapter 3. Actually took your example code. See 3.13.vb. Isn't that funny? I thought DirectoryServices was a wrapper to ADSI? Why do you say they are not equivalent? Y They aren't equivalent. Try using the .Value property instead: user.Properties("description").Value = xxxx Description is a funny property in AD in that the schema says that it allows multiple values, but the DS itself will only allow it to contain a single value for backward compatibility with previous DS APIs. That might be part of the problem here. In any event, it is generally always good practice to use the .Value property to set a single value. There is more info on this in ch 6 of our book (www.directoryprogramming.net). Joe K. ----- Original Message ----- From: "AD" <[EMAIL PROTECTED]> To: <ActiveDir@mail.activedir.org> Sent: Thursday, December 28, 2006 10:13 AM Subject: [ActiveDir] DirectoryServices vb.net is broken. I have a user with no description attribute. Anyone know why this works? User.Invoke("put", New Object() {"description", txtBxNewDescription.Text}) User.commitChanges but this doesn't User.Properties("Description").Add(txtBxNewDescription.Text) User.commitChanges I get the following error message. ComError {"A constraint violation occurred. (Exception from HRESULT: 0x8007202F)"} System.DirectoryServices.DirectoryServicesCOMException Thanks Yves St-Cyr List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.activedir.org/ma/default.aspx List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.activedir.org/ma/default.aspx List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.activedir.org/ma/default.aspx
<<winmail.dat>>