Updating Member Properties Using ADSI May Cause Corruption (231732)
The information in this article applies to:
- Microsoft Site Server 3.0
This article was previously published under Q231732 SYMPTOMS
When you use ADSI to programmatically change member properties in a Site Server Membership database, some of the properties may become corrupt. Note that this only occurs when you attempt to set one or more properties to a null value, which is not normally possible through the Site Server Administration interface.
CAUSE
This problem occurs when you update multiple properties before the call to SetInfo and you set one or more of these properties to a null string. This is caused by a problem in Site Server Membership.
The following VBScript sample code demonstrates the problem. This example assumes there is a Membership database called TestMembership, and that the anonymous user has rights to create and modify members.
On Error Resume Next
server = "yourservername" ' the name of your site server machine
Port = ":1003" ' the port the membership is configured on
membershipname = "TestMembership"
nameofmembercontainer = "Members" ' for a newly created membership this will usually be Members
membercontainerpath = "LDAP://" & server & Port & "/ou=" & nameofmembercontainer & ",o=" & membershipname
Set membercontainer = GetObject(membercontainerpath)
Set member = membercontainer.Create("member", "cn=JohnDoe")
member.Put "GUID", "0123456789" 'this is not a real GUID and should be used only for this test
member.Put "mail", "myaddress@myhouse"
member.Put "givenName", "John"
member.Put "sn", "Doe"
member.Put "c", "United States"
member.SetInfo
If Err <> 0 Then
MsgBox "Error number " & Hex(Err)
Else
MsgBox "New member successfully added"
End If
' get the latest values from the server rather than the cache
member.GetInfo
' show properties
MsgBox "mail=" & member.Get("mail")
MsgBox "c=" & member.Get("c")
MsgBox "givenName=" & member.Get("givenName")
MsgBox "sn=" & member.Get("sn")
' make changes
member.Put "mail", "" ' note we are specifying a null length string here
member.Put "givenName", "Jane"
member.Put "sn", "Doe"
member.SetInfo
MsgBox "Changes complete. About to display all properties again"
' get the latest values from the server rather than the cache
member.GetInfo
' show properties again
MsgBox "mail=" & member.Get("mail")
MsgBox "c=" & member.Get("c")
MsgBox "givenName=" & member.Get("givenName")
MsgBox "sn=" & member.Get("sn")
MsgBox "About to delete member"
membercontainer.Delete "member", "cn=JohnDoe"
MsgBox "Member deleted"
To run the above script, if you have the Windows Scripting Host installed, put the script in a file with a .vbs extension and double-click it. Alternatively, you can adapt the code to run as an ASP script in a Web page (note that you will need to remove the MsgBox functions).
When you run this code, a new member is created and some properties are set. The values of these properties are then displayed in message boxes as confirmation. Some updates are then made to these properties, including an update to the e-mail address, setting it to a null string. The properties of the member are then displayed again. This time, you should see that the givenName property is now something like ¬?ne. The details of the corruption may vary.
RESOLUTIONTo resolve this problem, obtain the latest service pack for Site Server version 3.0. For additional information, click the following article number to view the article in the
Microsoft Knowledge Base:
219292 How to Obtain the Latest Site Server 3.0 Service Pack
NOTE: This fix only addresses null values in string columns. The problem is still an issue if the null value is located in an integer column.
To work around this problem, remove the null values from the column that is displaying incorrectly in the Site Server MMC, Membership Directory Manager (MDM).
WORKAROUND
To work around this problem, call SetInfo after each PUT command, as in the following example:
member.Put "mail", "" ' note we are specifying a null length string here
member.SetInfo
member.Put "givenName", "Jane"<BR/>
member.SetInfo
member.Put "sn", "Doe"<BR/>
member.SetInfo
STATUSMicrosoft has confirmed that this is a problem in Site Server version 3.0. This problem was first corrected in Site Server 3.0 Service Pack 4.
Modification Type: | Minor | Last Reviewed: | 9/22/2005 |
---|
Keywords: | kbHotfixServer kbQFE kbbug kbfix kbSiteServ300sp4fix KB231732 |
---|
|