The System.director yservices.dll has an error, and this error was described
in http://support.microsoft.com/default...b;en-us;839424
At the moment we have Framework version v1.0.3705 and I have remove
System.director yservices.dll from current Framework version v1.0.3705. In
state of old version I load die new System.director yservices.dll from the
Framework version v1.1.4322.
I work with the following function of Joe Kaplan \(MVP - ADSI ) 8 Jan. In
2004 uses 22:59 (see below). But if I have more than 1000 Members, I receive
this error:
_COMPlusExcepti onCode:-532459699
_message: "In operations error occurred."
_HResult:-2147016672
_xcode:-532459699
StackTrace:"at System . DirectoryServic es . Interop . IAds . GetInfoEx
(Object vProperties, Int32 lnReserved) at System . DirectoryServic es .
DirectoryEntry . RefreshCache (String [] propertyNames) at SWDIS.MainSWDis .
GetAllAttribute Values (DirectoryEntry entry, String attributeName) in
C:\Develop\Test AD\MainTestAD.v b:line 679"
I has reduced Increment from 1000 to 500 and has ignored code line
....If attributeValues .Count < 1000 Then...
,till 999 (1000) I receive all Members. By 3-rd loop (the range string was
"member;range=1 000-1499") I get this error by the function entry.RefreshCa che
(New string () {currentRange}) !
The version of system.Enterpri seServices.dll is 1.1.4322.2032 88.0 KB
(90'112 bytes). And old version of system.Enterpri seServices.dll was
1.0.3705.6018 84.0 KB (86'016 bytes).
Can somebody help?
VB.NET Code from Joe Kaplan \(MVP - ADSI ) 8 Jan. In 2004 uses 22:59
############### ############### ############### ###############
Protected Shared Function GetAllAttribute Values(ByVal entry As
DirectoryEntry, ByVal attributeName As String) As ArrayList
Dim propValues As PropertyValueCo llection
Dim propValue As Object
Dim attributeValues As PropertyValueCo llection
Dim values As ArrayList
Dim currentRange As String
Dim startCount As Integer
Dim endCount As Integer
Dim iteration As Integer
Dim increment As Integer = 500 '1000
Dim expectedErrorCo de As Integer = -2147016672
'This optimization reads the attributey directly if it
'contains less than 1000 values and returns an arraylist based
'on that. If we have 1000 values, we assume that there are likely
more than
'1000 values and we resort to the slower attribute ranging method()
'done below
entry.RefreshCa che(New String() {attributeName} )
attributeValues = entry.Propertie s(attributeName )
If attributeValues .Count < 1000 Then
Dim memberValue As Object
values = New ArrayList(attri buteValues.Coun t)
For Each memberValue In attributeValues
values.Add(memb erValue)
Next
values.TrimToSi ze()
Return values
End If
'here we go into ranging mode
values = New ArrayList(1000)
Do
startCount = iteration * increment
endCount = (iteration + 1) * increment - 1
'This is the attribute ranging method for retrieving the
contents of large attributes
currentRange = String.Format(" {0};Range={1}-{2}", attributeName,
startCount, endCount)
currentRange = String.Format(" member;range={0 }-{1}", startCount,
endCount)
'this will throw when the lower bound on the range is too high()
Try
entry.RefreshCa che(New String() {currentRange})
Catch e As Exception 'I might check for the expected hresult,
but I don't know if I need to
Exit Do
End Try
'Get the values for for the current range of attributes
propValues = entry.Propertie s(attributeName )
For Each propValue In propValues
values.Add(prop Value)
Next
iteration += 1
values.Capacity += increment
Loop
values.TrimToSi ze()
Return values
End Function
############### ############### ############### ###############
Thanks and Best regards