By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,954 Members | 1,133 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,954 IT Pros & Developers. It's quick & easy.

Retriving User Details from Active Directory in VB using ADODB

P: n/a
Hi!

I am trying to retrieve user details from a Windows 2000 Active Directory using ADO and am successful to retrieve all info except the Postal address... I get the following error when I try to use "PostalAddresses" property of an "IADsUser" object.

Following is the code that I have used...

Dim User As IADsUser

Set User = GetObject(rs("adspath"))
'rs is a recordset object containing AD info.

UserFName = User.FirstName
UserLName = User.LastName
UserDepartmentName = User.Department
UserTelePhoneNo = User.TelephoneNumber
'Alls well till this point...
UserAddress = User.PostalAddresses()
Here is where I get following error :-
Number :- -2147463155
Description :- "The Active Directory property cannot be found in the cache."

Would appreciate if someone points out what the problem on hand is and suggest a workaround for the same.

Thanks in advance,
Kuntesh Desai
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Wed, 19 May 2004 18:01:42 +0530, "Kuntesh Desai" <ku**********@softhome.net> wrote:

Hi!

I am trying to retrieve user details from a Windows 2000 Active Directory using ADO and am successful to retrieve all info except the Postal address... I get the following error when I try to use "PostalAddresses" property of an "IADsUser" object.

Following is the code that I have used...

Dim User As IADsUser

Set User = GetObject(rs("adspath"))
'rs is a recordset object containing AD info.

UserFName = User.FirstName
UserLName = User.LastName
UserDepartmentName = User.Department
UserTelePhoneNo = User.TelephoneNumber
'Alls well till this point...
UserAddress = User.PostalAddresses()
Here is where I get following error :-
Number :- -2147463155
Description :- "The Active Directory property cannot be found in the cache."

Would appreciate if someone points out what the problem on hand is and suggest a workaround for the same.

The PostalAddress property is an array of Variants. You probably need to define UserAddress as an
Object and call GetEx to return the array of address lines.

UserAddress = User.GetEx("PostalAddress")
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 20 '05 #2

P: n/a
Paul,

I tried using your suggestion, however I still get the same error.

Thanks for the efforts though.
Kuntesh Desai

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:1q********************************@4ax.com...
On Wed, 19 May 2004 18:01:42 +0530, "Kuntesh Desai" <ku**********@softhome.net> wrote:
Hi!

I am trying to retrieve user details from a Windows 2000 Active Directory using ADO and am successful to retrieve all info except the Postal
address... I get the following error when I try to use "PostalAddresses"
property of an "IADsUser" object.
Following is the code that I have used...

Dim User As IADsUser

Set User = GetObject(rs("adspath"))
'rs is a recordset object containing AD info.

UserFName = User.FirstName
UserLName = User.LastName
UserDepartmentName = User.Department
UserTelePhoneNo = User.TelephoneNumber
'Alls well till this point...
UserAddress = User.PostalAddresses()
Here is where I get following error :-
Number :- -2147463155
Description :- "The Active Directory property cannot be found in the cache."
Would appreciate if someone points out what the problem on hand is and suggest a workaround for the same.
The PostalAddress property is an array of Variants. You probably need to define UserAddress as an Object and call GetEx to return the array of address lines.

UserAddress = User.GetEx("PostalAddress")
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 20 '05 #3

P: n/a
On Thu, 20 May 2004 12:45:52 +0530, "Kuntesh Desai" <ku**********@softhome.net> wrote:

Paul,

I tried using your suggestion, however I still get the same error.

Thanks for the efforts though.
Kuntesh Desai

Well I looked at your code but not the error you were receiving. Was the PostalAddress property
originally added to the AD User record? If it wasn't then the actual *property* will not be stored.
PostalAddress is an extended property of the IADUser object.
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.