Here is the function:
Expand|Select|Wrap|Line Numbers
- Function GetGroups(DistinguishedName)
- 'Returns an array of groups or a 1-element array detailing the error.
- Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D
- Dim oUser,asGroups,sGp
- Dim oConn,oCmd,oRS
- 'This object is not set correctly when on an ASP page
- Set oUser = GetObject(DistinguishedName)
- On Error Resume Next
- asGroups = oUser.GetEx("memberOf") 'An array of groups
- If Err.Number <> 0 Then
- if Err.Number = E_ADS_PROPERTY_NOT_FOUND Then
- asGroups=Array("Err.Number","the member attribute is not set")
- else
- asGroups=Array(Err.Number, Err.Description)
- end if
- End If
- GetGroups=asGroups
- End Function
I suspect that the problem arises because the asp page is running in a security context that does not allow the ojbect to be created.
How do I fix this?
Alternatives?
--Maugris