Page 1 of 1 1
Topic Options
#79773 - 2003-08-26 07:32 PM COM Bug still unresolved in 4.22rc1
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
This issue existed in 4.02 to present.
GetInfoEx does not return error and does not fill property cache.

Code that demostrates this issue (both vbs and KiXtart) is avaialble at this link:
COM Bug - ADSI GetInfoEx
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#79774 - 2003-08-28 02:14 PM Re: COM Bug still unresolved in 4.22rc1
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Thanks for the headsup.

The thing is that it's not KiXtart, or KiXtart COM that is failing here. What's wrong is that 'canonicalName' is a display-name, not the actual property-name (which is 'cn').

If you change your sample to use 'cn', you will see it works fine.

Apparently vbs does some name-translation before querying AD.

More later, thanks again!

Ruud

Top
#79775 - 2003-08-28 03:17 PM Re: COM Bug still unresolved in 4.22rc1
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I really think that the issue is with KiXtart COM & GetInfoEX. this is demonstrated by the fact that the property cache is NOT overwritten in my example code. The count of 33 (IIRC) values from GetInfo should be reduced to 1 if GetInfoEx actually worked.

quote:
Non-stored, constructed properties
A user object also has constructed properties that are not stored in the directory but are calculated by the domain controller (such as canonicalName, distinguishedName, allowedAttributes, ADsPath, and so on). Note that distinguishedName and ADsPath are not defined in the schema. All the constructed properties can be retrieved by IDirectoryObject and IDirectorySearch methods. Most are automatically retrieved and cached with a IADs::GetInfo call on the user object (Note IADs::Get does an implicit IADs::GetInfo call if the cache is empty). However, some constructed properties are not and therefore require a IADs::GetInfoEx call to explicitly retrieve them. For example, canonicalName is not retrieved with a IADs::GetInfo call and therefore IADs::Get will return a E_ADS_PROPERTY_NOT_FOUND error and enumeration of all properties using IADsPropertyList will not include the canonicalName property.

quote:
Example Code for Reading a Constructed Property
[This is preliminary documentation and subject to change.]

The following code fragments read the canonicalName property of the Administrator.


code:
'Read the canonicalName of Administrator
Dim rootDSE As IADs
Dim user As IADs

sPrefix = "LDAP://"
Set rootDSE = GetObject(sPrefix & "rootDSE")
If (Err.Number <> 0) Then
BailOnFailure Err.Number, "on GetObject method"
End If
sDomain = rootDSE.Get("defaultNamingContext")
If (Err.Number <> 0) Then
BailOnFailure Err.Number, "on Get method"
End If
sUserDN = "cn=Administrator,cn=users," + sDomain
'''''''''''''''''''''''''''''''''''''''
'Bind to the Administrator user
'''''''''''''''''''''''''''''''''''''''
Set user = GetObject(sPrefix & sUserDN)
user.GetInfoEx Array("canonicalName"), 0
strText = "Canonical Name: " & user.Get("canonicalName")
If (Err.Number <> 0) Then
BailOnFailure Err.Number, "on Get method"
End If
show_items strText, sComputer

'''''''''''''''''''''''''''''''''''''''
'Display subroutines
'''''''''''''''''''''''''''''''''''''''
Sub show_items(strText, strName)
MsgBox strText, vbInformation, "Get canonicalName for Administrator"
End Sub

Sub BailOnFailure(ErrNum, ErrText) strText = "Error 0x" & Hex(ErrNum) & " " & ErrText
MsgBox strText, vbInformation, "ADSI Error"
WScript.Quit
End Sub



[ 28. August 2003, 15:19: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#79776 - 2003-09-02 05:54 PM Re: COM Bug still unresolved in 4.22rc1
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
In short: thanks very much for your persistence! You are very right, this was broken in KiXtart, and is now fixed in the final build of 4.22.

Thanks again!

Ruud

Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2141 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.14 seconds in which 0.115 seconds were spent on a total of 12 queries. Zlib compression enabled.