Home All Groups Group Topic Archive Search About

VB .Net with ADSI problem

Author
30 Mar 2006 8:38 AM
Jonathan Smith
I am trying to develop an app using ADSI. I have the following code:

   Dim ADSUser As IADsUser

        ADSUser = GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")

        MessageBox.Show(ADSUser.EmailAddress)

When i try and run the program, i get the following error:

Cannot create ActiveX component

Any ideas what is causing this?

Author
30 Mar 2006 11:08 AM
Alexey Smirnov
what is your domain, and development machine, win2000?


Show quoteHide quote
"Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
>I am trying to develop an app using ADSI. I have the following code:
>
>   Dim ADSUser As IADsUser
>
>        ADSUser = GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>
>        MessageBox.Show(ADSUser.EmailAddress)
>
> When i try and run the program, i get the following error:
>
> Cannot create ActiveX component
>
> Any ideas what is causing this?
Author
30 Mar 2006 11:18 AM
Jonathan Smith
I am developing on a Windows XP desktop connected to our domain. The domain
controller is a Windows 2003 server machine

Show quoteHide quote
"Alexey Smirnov" wrote:

> what is your domain, and development machine, win2000?
>
>
> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
> >I am trying to develop an app using ADSI. I have the following code:
> >
> >   Dim ADSUser As IADsUser
> >
> >        ADSUser = GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >
> >        MessageBox.Show(ADSUser.EmailAddress)
> >
> > When i try and run the program, i get the following error:
> >
> > Cannot create ActiveX component
> >
> > Any ideas what is causing this?
>
>
>
Author
30 Mar 2006 11:48 AM
Alexey Smirnov
I got it, you shouldn't use old VB-GetObject function, use
System.DirectoryServices


Show quoteHide quote
"Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
>I am developing on a Windows XP desktop connected to our domain. The domain
> controller is a Windows 2003 server machine
>
> "Alexey Smirnov" wrote:
>
>> what is your domain, and development machine, win2000?
>>
>>
>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> message
>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
>> >I am trying to develop an app using ADSI. I have the following code:
>> >
>> >   Dim ADSUser As IADsUser
>> >
>> >        ADSUser =
>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >
>> >        MessageBox.Show(ADSUser.EmailAddress)
>> >
>> > When i try and run the program, i get the following error:
>> >
>> > Cannot create ActiveX component
>> >
>> > Any ideas what is causing this?
>>
>>
>>
Author
30 Mar 2006 11:56 AM
Alexey Smirnov
an example

Imports System.DirectoryServices

.....
Dim myDirectoryEntry As DirectoryEntry
myDirectoryEntry = New
DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")

Dim ADSUser As ActiveDs.IADsUser
ADSUser = myDirectoryEntry.NativeObject()

Regards,


Show quoteHide quote
"Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
>I got it, you shouldn't use old VB-GetObject function, use
>System.DirectoryServices
>
>
> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> message news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
>>I am developing on a Windows XP desktop connected to our domain. The
>>domain
>> controller is a Windows 2003 server machine
>>
>> "Alexey Smirnov" wrote:
>>
>>> what is your domain, and development machine, win2000?
>>>
>>>
>>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>>> message
>>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
>>> >I am trying to develop an app using ADSI. I have the following code:
>>> >
>>> >   Dim ADSUser As IADsUser
>>> >
>>> >        ADSUser =
>>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>>> >
>>> >        MessageBox.Show(ADSUser.EmailAddress)
>>> >
>>> > When i try and run the program, i get the following error:
>>> >
>>> > Cannot create ActiveX component
>>> >
>>> > Any ideas what is causing this?
>>>
>>>
>>>
>
>
Author
30 Mar 2006 12:41 PM
Jonathan Smith
Thanks for that, i have made a little more progress now, but it is still not
working. I am getting "No such object on the server", but i know the object
exists as it is my user!!!!

The code is:

Dim myDirectoryEntry As DirectoryEntry
        myDirectoryEntry = New DirectoryEntry("LDAP://CN=""Jonathan
Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")

        Dim ADSUser As ActiveDs.IADsUser
        ADSUser = myDirectoryEntry.NativeObject()


        MessageBox.Show(ADSUser.EmailAddress)



Show quoteHide quote
"Alexey Smirnov" wrote:

> an example
>
> Imports System.DirectoryServices
>
> .....
> Dim myDirectoryEntry As DirectoryEntry
> myDirectoryEntry = New
> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>
> Dim ADSUser As ActiveDs.IADsUser
> ADSUser = myDirectoryEntry.NativeObject()
>
> Regards,
>
>
> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
> >I got it, you shouldn't use old VB-GetObject function, use
> >System.DirectoryServices
> >
> >
> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> > message news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
> >>I am developing on a Windows XP desktop connected to our domain. The
> >>domain
> >> controller is a Windows 2003 server machine
> >>
> >> "Alexey Smirnov" wrote:
> >>
> >>> what is your domain, and development machine, win2000?
> >>>
> >>>
> >>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >>> message
> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
> >>> >I am trying to develop an app using ADSI. I have the following code:
> >>> >
> >>> >   Dim ADSUser As IADsUser
> >>> >
> >>> >        ADSUser =
> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >>> >
> >>> >        MessageBox.Show(ADSUser.EmailAddress)
> >>> >
> >>> > When i try and run the program, i get the following error:
> >>> >
> >>> > Cannot create ActiveX component
> >>> >
> >>> > Any ideas what is causing this?
> >>>
> >>>
> >>>
> >
> >
>
>
>
Author
30 Mar 2006 1:12 PM
Alexey Smirnov
sorry, I think I told you more code than you needed

Dim myDirectoryEntry As DirectoryEntry
myDirectoryEntry = New DirectoryEntry("LDAP://...")
Console.WriteLine("EmailAddress: " &
myDirectoryEntry.Properties("mail").Value)

This code is working for me.

Please check



Show quoteHide quote
"Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
news:D800494B-2AF6-421A-80BF-11822D3E3683@microsoft.com...
> Thanks for that, i have made a little more progress now, but it is still
> not
> working. I am getting "No such object on the server", but i know the
> object
> exists as it is my user!!!!
>
> The code is:
>
> Dim myDirectoryEntry As DirectoryEntry
>        myDirectoryEntry = New DirectoryEntry("LDAP://CN=""Jonathan
> Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")
>
>        Dim ADSUser As ActiveDs.IADsUser
>        ADSUser = myDirectoryEntry.NativeObject()
>
>
>        MessageBox.Show(ADSUser.EmailAddress)
>
>
>
> "Alexey Smirnov" wrote:
>
>> an example
>>
>> Imports System.DirectoryServices
>>
>> .....
>> Dim myDirectoryEntry As DirectoryEntry
>> myDirectoryEntry = New
>> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>>
>> Dim ADSUser As ActiveDs.IADsUser
>> ADSUser = myDirectoryEntry.NativeObject()
>>
>> Regards,
>>
>>
>> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
>> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
>> >I got it, you shouldn't use old VB-GetObject function, use
>> >System.DirectoryServices
>> >
>> >
>> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> > message news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
>> >>I am developing on a Windows XP desktop connected to our domain. The
>> >>domain
>> >> controller is a Windows 2003 server machine
>> >>
>> >> "Alexey Smirnov" wrote:
>> >>
>> >>> what is your domain, and development machine, win2000?
>> >>>
>> >>>
>> >>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> >>> message
>> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
>> >>> >I am trying to develop an app using ADSI. I have the following code:
>> >>> >
>> >>> >   Dim ADSUser As IADsUser
>> >>> >
>> >>> >        ADSUser =
>> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >>> >
>> >>> >        MessageBox.Show(ADSUser.EmailAddress)
>> >>> >
>> >>> > When i try and run the program, i get the following error:
>> >>> >
>> >>> > Cannot create ActiveX component
>> >>> >
>> >>> > Any ideas what is causing this?
>> >>>
>> >>>
>> >>>
>> >
>> >
>>
>>
>>
Author
30 Mar 2006 1:32 PM
Jonathan Smith
Sorry to be a pain, and i really appreciate your help. But, i am now getting
the message "a referral was returned from the server". The code is:

Dim myDirectoryEntry As DirectoryEntry
        myDirectoryEntry = New DirectoryEntry("LDAP://CN=Jonathan
Smith,DC=sc-file,DC=servicecentre")
        Console.WriteLine("EmailAddress: " &
myDirectoryEntry.Properties("mail").Value)

Show quoteHide quote
"Alexey Smirnov" wrote:

> sorry, I think I told you more code than you needed
>
> Dim myDirectoryEntry As DirectoryEntry
> myDirectoryEntry = New DirectoryEntry("LDAP://...")
> Console.WriteLine("EmailAddress: " &
> myDirectoryEntry.Properties("mail").Value)
>
> This code is working for me.
>
> Please check
>
>
>
> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
> news:D800494B-2AF6-421A-80BF-11822D3E3683@microsoft.com...
> > Thanks for that, i have made a little more progress now, but it is still
> > not
> > working. I am getting "No such object on the server", but i know the
> > object
> > exists as it is my user!!!!
> >
> > The code is:
> >
> > Dim myDirectoryEntry As DirectoryEntry
> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=""Jonathan
> > Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")
> >
> >        Dim ADSUser As ActiveDs.IADsUser
> >        ADSUser = myDirectoryEntry.NativeObject()
> >
> >
> >        MessageBox.Show(ADSUser.EmailAddress)
> >
> >
> >
> > "Alexey Smirnov" wrote:
> >
> >> an example
> >>
> >> Imports System.DirectoryServices
> >>
> >> .....
> >> Dim myDirectoryEntry As DirectoryEntry
> >> myDirectoryEntry = New
> >> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >>
> >> Dim ADSUser As ActiveDs.IADsUser
> >> ADSUser = myDirectoryEntry.NativeObject()
> >>
> >> Regards,
> >>
> >>
> >> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
> >> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
> >> >I got it, you shouldn't use old VB-GetObject function, use
> >> >System.DirectoryServices
> >> >
> >> >
> >> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >> > message news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
> >> >>I am developing on a Windows XP desktop connected to our domain. The
> >> >>domain
> >> >> controller is a Windows 2003 server machine
> >> >>
> >> >> "Alexey Smirnov" wrote:
> >> >>
> >> >>> what is your domain, and development machine, win2000?
> >> >>>
> >> >>>
> >> >>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >> >>> message
> >> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
> >> >>> >I am trying to develop an app using ADSI. I have the following code:
> >> >>> >
> >> >>> >   Dim ADSUser As IADsUser
> >> >>> >
> >> >>> >        ADSUser =
> >> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >> >>> >
> >> >>> >        MessageBox.Show(ADSUser.EmailAddress)
> >> >>> >
> >> >>> > When i try and run the program, i get the following error:
> >> >>> >
> >> >>> > Cannot create ActiveX component
> >> >>> >
> >> >>> > Any ideas what is causing this?
> >> >>>
> >> >>>
> >> >>>
> >> >
> >> >
> >>
> >>
> >>
>
>
>
Author
30 Mar 2006 1:47 PM
Alexey Smirnov
Where do you use it, is it Windows app, or ASP.NET?
I tested it in WinForms application and my account has permissions to
request AD.

On which line you get that error?

BR,
Alexey


Show quoteHide quote
"Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
news:6A98CF34-E041-4EB6-9D9E-130DF70D5B4E@microsoft.com...
> Sorry to be a pain, and i really appreciate your help. But, i am now
> getting
> the message "a referral was returned from the server". The code is:
>
> Dim myDirectoryEntry As DirectoryEntry
>        myDirectoryEntry = New DirectoryEntry("LDAP://CN=Jonathan
> Smith,DC=sc-file,DC=servicecentre")
>        Console.WriteLine("EmailAddress: " &
> myDirectoryEntry.Properties("mail").Value)
>
> "Alexey Smirnov" wrote:
>
>> sorry, I think I told you more code than you needed
>>
>> Dim myDirectoryEntry As DirectoryEntry
>> myDirectoryEntry = New DirectoryEntry("LDAP://...")
>> Console.WriteLine("EmailAddress: " &
>> myDirectoryEntry.Properties("mail").Value)
>>
>> This code is working for me.
>>
>> Please check
>>
>>
>>
>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> message
>> news:D800494B-2AF6-421A-80BF-11822D3E3683@microsoft.com...
>> > Thanks for that, i have made a little more progress now, but it is
>> > still
>> > not
>> > working. I am getting "No such object on the server", but i know the
>> > object
>> > exists as it is my user!!!!
>> >
>> > The code is:
>> >
>> > Dim myDirectoryEntry As DirectoryEntry
>> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=""Jonathan
>> > Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")
>> >
>> >        Dim ADSUser As ActiveDs.IADsUser
>> >        ADSUser = myDirectoryEntry.NativeObject()
>> >
>> >
>> >        MessageBox.Show(ADSUser.EmailAddress)
>> >
>> >
>> >
>> > "Alexey Smirnov" wrote:
>> >
>> >> an example
>> >>
>> >> Imports System.DirectoryServices
>> >>
>> >> .....
>> >> Dim myDirectoryEntry As DirectoryEntry
>> >> myDirectoryEntry = New
>> >> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >>
>> >> Dim ADSUser As ActiveDs.IADsUser
>> >> ADSUser = myDirectoryEntry.NativeObject()
>> >>
>> >> Regards,
>> >>
>> >>
>> >> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
>> >> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
>> >> >I got it, you shouldn't use old VB-GetObject function, use
>> >> >System.DirectoryServices
>> >> >
>> >> >
>> >> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> >> > message news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
>> >> >>I am developing on a Windows XP desktop connected to our domain. The
>> >> >>domain
>> >> >> controller is a Windows 2003 server machine
>> >> >>
>> >> >> "Alexey Smirnov" wrote:
>> >> >>
>> >> >>> what is your domain, and development machine, win2000?
>> >> >>>
>> >> >>>
>> >> >>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote
>> >> >>> in
>> >> >>> message
>> >> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
>> >> >>> >I am trying to develop an app using ADSI. I have the following
>> >> >>> >code:
>> >> >>> >
>> >> >>> >   Dim ADSUser As IADsUser
>> >> >>> >
>> >> >>> >        ADSUser =
>> >> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >> >>> >
>> >> >>> >        MessageBox.Show(ADSUser.EmailAddress)
>> >> >>> >
>> >> >>> > When i try and run the program, i get the following error:
>> >> >>> >
>> >> >>> > Cannot create ActiveX component
>> >> >>> >
>> >> >>> > Any ideas what is causing this?
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>
Author
30 Mar 2006 2:00 PM
Jonathan Smith
The error is occurring on this line:
Console.Write("EmailAddress: " & myDirectoryEntry.Properties("mail").Value)

i have tried running the code as an administrative user, but get the same
result

Show quoteHide quote
"Alexey Smirnov" wrote:

> Where do you use it, is it Windows app, or ASP.NET?
> I tested it in WinForms application and my account has permissions to
> request AD.
>
> On which line you get that error?
>
> BR,
> Alexey
>
>
> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
> news:6A98CF34-E041-4EB6-9D9E-130DF70D5B4E@microsoft.com...
> > Sorry to be a pain, and i really appreciate your help. But, i am now
> > getting
> > the message "a referral was returned from the server". The code is:
> >
> > Dim myDirectoryEntry As DirectoryEntry
> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=Jonathan
> > Smith,DC=sc-file,DC=servicecentre")
> >        Console.WriteLine("EmailAddress: " &
> > myDirectoryEntry.Properties("mail").Value)
> >
> > "Alexey Smirnov" wrote:
> >
> >> sorry, I think I told you more code than you needed
> >>
> >> Dim myDirectoryEntry As DirectoryEntry
> >> myDirectoryEntry = New DirectoryEntry("LDAP://...")
> >> Console.WriteLine("EmailAddress: " &
> >> myDirectoryEntry.Properties("mail").Value)
> >>
> >> This code is working for me.
> >>
> >> Please check
> >>
> >>
> >>
> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >> message
> >> news:D800494B-2AF6-421A-80BF-11822D3E3683@microsoft.com...
> >> > Thanks for that, i have made a little more progress now, but it is
> >> > still
> >> > not
> >> > working. I am getting "No such object on the server", but i know the
> >> > object
> >> > exists as it is my user!!!!
> >> >
> >> > The code is:
> >> >
> >> > Dim myDirectoryEntry As DirectoryEntry
> >> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=""Jonathan
> >> > Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")
> >> >
> >> >        Dim ADSUser As ActiveDs.IADsUser
> >> >        ADSUser = myDirectoryEntry.NativeObject()
> >> >
> >> >
> >> >        MessageBox.Show(ADSUser.EmailAddress)
> >> >
> >> >
> >> >
> >> > "Alexey Smirnov" wrote:
> >> >
> >> >> an example
> >> >>
> >> >> Imports System.DirectoryServices
> >> >>
> >> >> .....
> >> >> Dim myDirectoryEntry As DirectoryEntry
> >> >> myDirectoryEntry = New
> >> >> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >> >>
> >> >> Dim ADSUser As ActiveDs.IADsUser
> >> >> ADSUser = myDirectoryEntry.NativeObject()
> >> >>
> >> >> Regards,
> >> >>
> >> >>
> >> >> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
> >> >> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
> >> >> >I got it, you shouldn't use old VB-GetObject function, use
> >> >> >System.DirectoryServices
> >> >> >
> >> >> >
> >> >> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >> >> > message news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
> >> >> >>I am developing on a Windows XP desktop connected to our domain. The
> >> >> >>domain
> >> >> >> controller is a Windows 2003 server machine
> >> >> >>
> >> >> >> "Alexey Smirnov" wrote:
> >> >> >>
> >> >> >>> what is your domain, and development machine, win2000?
> >> >> >>>
> >> >> >>>
> >> >> >>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote
> >> >> >>> in
> >> >> >>> message
> >> >> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
> >> >> >>> >I am trying to develop an app using ADSI. I have the following
> >> >> >>> >code:
> >> >> >>> >
> >> >> >>> >   Dim ADSUser As IADsUser
> >> >> >>> >
> >> >> >>> >        ADSUser =
> >> >> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >> >> >>> >
> >> >> >>> >        MessageBox.Show(ADSUser.EmailAddress)
> >> >> >>> >
> >> >> >>> > When i try and run the program, i get the following error:
> >> >> >>> >
> >> >> >>> > Cannot create ActiveX component
> >> >> >>> >
> >> >> >>> > Any ideas what is causing this?
> >> >> >>>
> >> >> >>>
> >> >> >>>
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Author
30 Mar 2006 2:18 PM
Alexey Smirnov
well, then try to enumerate all properties at your entry

add this code
Dim p As String

Dim v As Object

For Each p In myDirectoryEntry.Properties.PropertyNames

For Each v In myDirectoryEntry.Properties(p)

Console.WriteLine(p & "=" & v.ToString)

Next v

Next p

instead the Console.Write("EmailAddress: " &
myDirectoryEntry.Properties("mail").Value)

You should get a list of properties/values in the Console Window



Show quoteHide quote
"Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
news:1E595D35-7025-478C-96C1-3E17F36C7603@microsoft.com...
> The error is occurring on this line:
> Console.Write("EmailAddress: " &
> myDirectoryEntry.Properties("mail").Value)
>
> i have tried running the code as an administrative user, but get the same
> result
>
> "Alexey Smirnov" wrote:
>
>> Where do you use it, is it Windows app, or ASP.NET?
>> I tested it in WinForms application and my account has permissions to
>> request AD.
>>
>> On which line you get that error?
>>
>> BR,
>> Alexey
>>
>>
>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> message
>> news:6A98CF34-E041-4EB6-9D9E-130DF70D5B4E@microsoft.com...
>> > Sorry to be a pain, and i really appreciate your help. But, i am now
>> > getting
>> > the message "a referral was returned from the server". The code is:
>> >
>> > Dim myDirectoryEntry As DirectoryEntry
>> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=Jonathan
>> > Smith,DC=sc-file,DC=servicecentre")
>> >        Console.WriteLine("EmailAddress: " &
>> > myDirectoryEntry.Properties("mail").Value)
>> >
>> > "Alexey Smirnov" wrote:
>> >
>> >> sorry, I think I told you more code than you needed
>> >>
>> >> Dim myDirectoryEntry As DirectoryEntry
>> >> myDirectoryEntry = New DirectoryEntry("LDAP://...")
>> >> Console.WriteLine("EmailAddress: " &
>> >> myDirectoryEntry.Properties("mail").Value)
>> >>
>> >> This code is working for me.
>> >>
>> >> Please check
>> >>
>> >>
>> >>
>> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> >> message
>> >> news:D800494B-2AF6-421A-80BF-11822D3E3683@microsoft.com...
>> >> > Thanks for that, i have made a little more progress now, but it is
>> >> > still
>> >> > not
>> >> > working. I am getting "No such object on the server", but i know the
>> >> > object
>> >> > exists as it is my user!!!!
>> >> >
>> >> > The code is:
>> >> >
>> >> > Dim myDirectoryEntry As DirectoryEntry
>> >> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=""Jonathan
>> >> > Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")
>> >> >
>> >> >        Dim ADSUser As ActiveDs.IADsUser
>> >> >        ADSUser = myDirectoryEntry.NativeObject()
>> >> >
>> >> >
>> >> >        MessageBox.Show(ADSUser.EmailAddress)
>> >> >
>> >> >
>> >> >
>> >> > "Alexey Smirnov" wrote:
>> >> >
>> >> >> an example
>> >> >>
>> >> >> Imports System.DirectoryServices
>> >> >>
>> >> >> .....
>> >> >> Dim myDirectoryEntry As DirectoryEntry
>> >> >> myDirectoryEntry = New
>> >> >> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >> >>
>> >> >> Dim ADSUser As ActiveDs.IADsUser
>> >> >> ADSUser = myDirectoryEntry.NativeObject()
>> >> >>
>> >> >> Regards,
>> >> >>
>> >> >>
>> >> >> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
>> >> >> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
>> >> >> >I got it, you shouldn't use old VB-GetObject function, use
>> >> >> >System.DirectoryServices
>> >> >> >
>> >> >> >
>> >> >> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote
>> >> >> > in
>> >> >> > message
>> >> >> > news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
>> >> >> >>I am developing on a Windows XP desktop connected to our domain.
>> >> >> >>The
>> >> >> >>domain
>> >> >> >> controller is a Windows 2003 server machine
>> >> >> >>
>> >> >> >> "Alexey Smirnov" wrote:
>> >> >> >>
>> >> >> >>> what is your domain, and development machine, win2000?
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com>
>> >> >> >>> wrote
>> >> >> >>> in
>> >> >> >>> message
>> >> >> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
>> >> >> >>> >I am trying to develop an app using ADSI. I have the following
>> >> >> >>> >code:
>> >> >> >>> >
>> >> >> >>> >   Dim ADSUser As IADsUser
>> >> >> >>> >
>> >> >> >>> >        ADSUser =
>> >> >> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >> >> >>> >
>> >> >> >>> >        MessageBox.Show(ADSUser.EmailAddress)
>> >> >> >>> >
>> >> >> >>> > When i try and run the program, i get the following error:
>> >> >> >>> >
>> >> >> >>> > Cannot create ActiveX component
>> >> >> >>> >
>> >> >> >>> > Any ideas what is causing this?
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>
Author
30 Mar 2006 2:28 PM
Jonathan Smith
Yeah, that seems to have worked. I reckon the problem is my LDAP query is
wrong. I will spend some time sorting the query syntax now.

Thanks for all your help

Show quoteHide quote
"Alexey Smirnov" wrote:

> well, then try to enumerate all properties at your entry
>
> add this code
> Dim p As String
>
> Dim v As Object
>
> For Each p In myDirectoryEntry.Properties.PropertyNames
>
> For Each v In myDirectoryEntry.Properties(p)
>
> Console.WriteLine(p & "=" & v.ToString)
>
> Next v
>
> Next p
>
> instead the Console.Write("EmailAddress: " &
> myDirectoryEntry.Properties("mail").Value)
>
> You should get a list of properties/values in the Console Window
>
>
>
> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
> news:1E595D35-7025-478C-96C1-3E17F36C7603@microsoft.com...
> > The error is occurring on this line:
> > Console.Write("EmailAddress: " &
> > myDirectoryEntry.Properties("mail").Value)
> >
> > i have tried running the code as an administrative user, but get the same
> > result
> >
> > "Alexey Smirnov" wrote:
> >
> >> Where do you use it, is it Windows app, or ASP.NET?
> >> I tested it in WinForms application and my account has permissions to
> >> request AD.
> >>
> >> On which line you get that error?
> >>
> >> BR,
> >> Alexey
> >>
> >>
> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >> message
> >> news:6A98CF34-E041-4EB6-9D9E-130DF70D5B4E@microsoft.com...
> >> > Sorry to be a pain, and i really appreciate your help. But, i am now
> >> > getting
> >> > the message "a referral was returned from the server". The code is:
> >> >
> >> > Dim myDirectoryEntry As DirectoryEntry
> >> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=Jonathan
> >> > Smith,DC=sc-file,DC=servicecentre")
> >> >        Console.WriteLine("EmailAddress: " &
> >> > myDirectoryEntry.Properties("mail").Value)
> >> >
> >> > "Alexey Smirnov" wrote:
> >> >
> >> >> sorry, I think I told you more code than you needed
> >> >>
> >> >> Dim myDirectoryEntry As DirectoryEntry
> >> >> myDirectoryEntry = New DirectoryEntry("LDAP://...")
> >> >> Console.WriteLine("EmailAddress: " &
> >> >> myDirectoryEntry.Properties("mail").Value)
> >> >>
> >> >> This code is working for me.
> >> >>
> >> >> Please check
> >> >>
> >> >>
> >> >>
> >> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:D800494B-2AF6-421A-80BF-11822D3E3683@microsoft.com...
> >> >> > Thanks for that, i have made a little more progress now, but it is
> >> >> > still
> >> >> > not
> >> >> > working. I am getting "No such object on the server", but i know the
> >> >> > object
> >> >> > exists as it is my user!!!!
> >> >> >
> >> >> > The code is:
> >> >> >
> >> >> > Dim myDirectoryEntry As DirectoryEntry
> >> >> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=""Jonathan
> >> >> > Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")
> >> >> >
> >> >> >        Dim ADSUser As ActiveDs.IADsUser
> >> >> >        ADSUser = myDirectoryEntry.NativeObject()
> >> >> >
> >> >> >
> >> >> >        MessageBox.Show(ADSUser.EmailAddress)
> >> >> >
> >> >> >
> >> >> >
> >> >> > "Alexey Smirnov" wrote:
> >> >> >
> >> >> >> an example
> >> >> >>
> >> >> >> Imports System.DirectoryServices
> >> >> >>
> >> >> >> .....
> >> >> >> Dim myDirectoryEntry As DirectoryEntry
> >> >> >> myDirectoryEntry = New
> >> >> >> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >> >> >>
> >> >> >> Dim ADSUser As ActiveDs.IADsUser
> >> >> >> ADSUser = myDirectoryEntry.NativeObject()
> >> >> >>
> >> >> >> Regards,
> >> >> >>
> >> >> >>
> >> >> >> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
> >> >> >> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
> >> >> >> >I got it, you shouldn't use old VB-GetObject function, use
> >> >> >> >System.DirectoryServices
> >> >> >> >
> >> >> >> >
> >> >> >> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote
> >> >> >> > in
> >> >> >> > message
> >> >> >> > news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
> >> >> >> >>I am developing on a Windows XP desktop connected to our domain.
> >> >> >> >>The
> >> >> >> >>domain
> >> >> >> >> controller is a Windows 2003 server machine
> >> >> >> >>
> >> >> >> >> "Alexey Smirnov" wrote:
> >> >> >> >>
> >> >> >> >>> what is your domain, and development machine, win2000?
> >> >> >> >>>
> >> >> >> >>>
> >> >> >> >>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com>
> >> >> >> >>> wrote
> >> >> >> >>> in
> >> >> >> >>> message
> >> >> >> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
> >> >> >> >>> >I am trying to develop an app using ADSI. I have the following
> >> >> >> >>> >code:
> >> >> >> >>> >
> >> >> >> >>> >   Dim ADSUser As IADsUser
> >> >> >> >>> >
> >> >> >> >>> >        ADSUser =
> >> >> >> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >> >> >> >>> >
> >> >> >> >>> >        MessageBox.Show(ADSUser.EmailAddress)
> >> >> >> >>> >
> >> >> >> >>> > When i try and run the program, i get the following error:
> >> >> >> >>> >
> >> >> >> >>> > Cannot create ActiveX component
> >> >> >> >>> >
> >> >> >> >>> > Any ideas what is causing this?
> >> >> >> >>>
> >> >> >> >>>
> >> >> >> >>>
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Author
30 Mar 2006 2:33 PM
Alexey Smirnov
great :-)

I'd recommend you to use LDAP browser, where you can check schemas of your
directory

the free version could be found at
http://www.ldapadministrator.com/download/index.php

BR,


Show quoteHide quote
"Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
news:112F9840-8420-43CB-8793-568F1C3A3278@microsoft.com...
> Yeah, that seems to have worked. I reckon the problem is my LDAP query is
> wrong. I will spend some time sorting the query syntax now.
>
> Thanks for all your help
>
> "Alexey Smirnov" wrote:
>
>> well, then try to enumerate all properties at your entry
>>
>> add this code
>> Dim p As String
>>
>> Dim v As Object
>>
>> For Each p In myDirectoryEntry.Properties.PropertyNames
>>
>> For Each v In myDirectoryEntry.Properties(p)
>>
>> Console.WriteLine(p & "=" & v.ToString)
>>
>> Next v
>>
>> Next p
>>
>> instead the Console.Write("EmailAddress: " &
>> myDirectoryEntry.Properties("mail").Value)
>>
>> You should get a list of properties/values in the Console Window
>>
>>
>>
>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> message
>> news:1E595D35-7025-478C-96C1-3E17F36C7603@microsoft.com...
>> > The error is occurring on this line:
>> > Console.Write("EmailAddress: " &
>> > myDirectoryEntry.Properties("mail").Value)
>> >
>> > i have tried running the code as an administrative user, but get the
>> > same
>> > result
>> >
>> > "Alexey Smirnov" wrote:
>> >
>> >> Where do you use it, is it Windows app, or ASP.NET?
>> >> I tested it in WinForms application and my account has permissions to
>> >> request AD.
>> >>
>> >> On which line you get that error?
>> >>
>> >> BR,
>> >> Alexey
>> >>
>> >>
>> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> >> message
>> >> news:6A98CF34-E041-4EB6-9D9E-130DF70D5B4E@microsoft.com...
>> >> > Sorry to be a pain, and i really appreciate your help. But, i am now
>> >> > getting
>> >> > the message "a referral was returned from the server". The code is:
>> >> >
>> >> > Dim myDirectoryEntry As DirectoryEntry
>> >> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=Jonathan
>> >> > Smith,DC=sc-file,DC=servicecentre")
>> >> >        Console.WriteLine("EmailAddress: " &
>> >> > myDirectoryEntry.Properties("mail").Value)
>> >> >
>> >> > "Alexey Smirnov" wrote:
>> >> >
>> >> >> sorry, I think I told you more code than you needed
>> >> >>
>> >> >> Dim myDirectoryEntry As DirectoryEntry
>> >> >> myDirectoryEntry = New DirectoryEntry("LDAP://...")
>> >> >> Console.WriteLine("EmailAddress: " &
>> >> >> myDirectoryEntry.Properties("mail").Value)
>> >> >>
>> >> >> This code is working for me.
>> >> >>
>> >> >> Please check
>> >> >>
>> >> >>
>> >> >>
>> >> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> >> >> message
>> >> >> news:D800494B-2AF6-421A-80BF-11822D3E3683@microsoft.com...
>> >> >> > Thanks for that, i have made a little more progress now, but it
>> >> >> > is
>> >> >> > still
>> >> >> > not
>> >> >> > working. I am getting "No such object on the server", but i know
>> >> >> > the
>> >> >> > object
>> >> >> > exists as it is my user!!!!
>> >> >> >
>> >> >> > The code is:
>> >> >> >
>> >> >> > Dim myDirectoryEntry As DirectoryEntry
>> >> >> >        myDirectoryEntry = New
>> >> >> > DirectoryEntry("LDAP://CN=""Jonathan
>> >> >> > Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")
>> >> >> >
>> >> >> >        Dim ADSUser As ActiveDs.IADsUser
>> >> >> >        ADSUser = myDirectoryEntry.NativeObject()
>> >> >> >
>> >> >> >
>> >> >> >        MessageBox.Show(ADSUser.EmailAddress)
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > "Alexey Smirnov" wrote:
>> >> >> >
>> >> >> >> an example
>> >> >> >>
>> >> >> >> Imports System.DirectoryServices
>> >> >> >>
>> >> >> >> .....
>> >> >> >> Dim myDirectoryEntry As DirectoryEntry
>> >> >> >> myDirectoryEntry = New
>> >> >> >> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >> >> >>
>> >> >> >> Dim ADSUser As ActiveDs.IADsUser
>> >> >> >> ADSUser = myDirectoryEntry.NativeObject()
>> >> >> >>
>> >> >> >> Regards,
>> >> >> >>
>> >> >> >>
>> >> >> >> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
>> >> >> >> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
>> >> >> >> >I got it, you shouldn't use old VB-GetObject function, use
>> >> >> >> >System.DirectoryServices
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com>
>> >> >> >> > wrote
>> >> >> >> > in
>> >> >> >> > message
>> >> >> >> > news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
>> >> >> >> >>I am developing on a Windows XP desktop connected to our
>> >> >> >> >>domain.
>> >> >> >> >>The
>> >> >> >> >>domain
>> >> >> >> >> controller is a Windows 2003 server machine
>> >> >> >> >>
>> >> >> >> >> "Alexey Smirnov" wrote:
>> >> >> >> >>
>> >> >> >> >>> what is your domain, and development machine, win2000?
>> >> >> >> >>>
>> >> >> >> >>>
>> >> >> >> >>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com>
>> >> >> >> >>> wrote
>> >> >> >> >>> in
>> >> >> >> >>> message
>> >> >> >> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
>> >> >> >> >>> >I am trying to develop an app using ADSI. I have the
>> >> >> >> >>> >following
>> >> >> >> >>> >code:
>> >> >> >> >>> >
>> >> >> >> >>> >   Dim ADSUser As IADsUser
>> >> >> >> >>> >
>> >> >> >> >>> >        ADSUser =
>> >> >> >> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >> >> >> >>> >
>> >> >> >> >>> >        MessageBox.Show(ADSUser.EmailAddress)
>> >> >> >> >>> >
>> >> >> >> >>> > When i try and run the program, i get the following error:
>> >> >> >> >>> >
>> >> >> >> >>> > Cannot create ActiveX component
>> >> >> >> >>> >
>> >> >> >> >>> > Any ideas what is causing this?
>> >> >> >> >>>
>> >> >> >> >>>
>> >> >> >> >>>
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>
Author
30 Mar 2006 3:06 PM
Jonathan Smith
THanks for that. What i am trying to achieve is to create a Windows
"dashboard" that will give me key data about my Exchange server.

Is this achievable by doing LDAP queries on my mail server?

I want to know things like "who is the domain mail server", what version of
exchange is it running, database path etc...



Show quoteHide quote
"Alexey Smirnov" wrote:

> great :-)
>
> I'd recommend you to use LDAP browser, where you can check schemas of your
> directory
>
> the free version could be found at
> http://www.ldapadministrator.com/download/index.php
>
> BR,
>
>
> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
> news:112F9840-8420-43CB-8793-568F1C3A3278@microsoft.com...
> > Yeah, that seems to have worked. I reckon the problem is my LDAP query is
> > wrong. I will spend some time sorting the query syntax now.
> >
> > Thanks for all your help
> >
> > "Alexey Smirnov" wrote:
> >
> >> well, then try to enumerate all properties at your entry
> >>
> >> add this code
> >> Dim p As String
> >>
> >> Dim v As Object
> >>
> >> For Each p In myDirectoryEntry.Properties.PropertyNames
> >>
> >> For Each v In myDirectoryEntry.Properties(p)
> >>
> >> Console.WriteLine(p & "=" & v.ToString)
> >>
> >> Next v
> >>
> >> Next p
> >>
> >> instead the Console.Write("EmailAddress: " &
> >> myDirectoryEntry.Properties("mail").Value)
> >>
> >> You should get a list of properties/values in the Console Window
> >>
> >>
> >>
> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >> message
> >> news:1E595D35-7025-478C-96C1-3E17F36C7603@microsoft.com...
> >> > The error is occurring on this line:
> >> > Console.Write("EmailAddress: " &
> >> > myDirectoryEntry.Properties("mail").Value)
> >> >
> >> > i have tried running the code as an administrative user, but get the
> >> > same
> >> > result
> >> >
> >> > "Alexey Smirnov" wrote:
> >> >
> >> >> Where do you use it, is it Windows app, or ASP.NET?
> >> >> I tested it in WinForms application and my account has permissions to
> >> >> request AD.
> >> >>
> >> >> On which line you get that error?
> >> >>
> >> >> BR,
> >> >> Alexey
> >> >>
> >> >>
> >> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:6A98CF34-E041-4EB6-9D9E-130DF70D5B4E@microsoft.com...
> >> >> > Sorry to be a pain, and i really appreciate your help. But, i am now
> >> >> > getting
> >> >> > the message "a referral was returned from the server". The code is:
> >> >> >
> >> >> > Dim myDirectoryEntry As DirectoryEntry
> >> >> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=Jonathan
> >> >> > Smith,DC=sc-file,DC=servicecentre")
> >> >> >        Console.WriteLine("EmailAddress: " &
> >> >> > myDirectoryEntry.Properties("mail").Value)
> >> >> >
> >> >> > "Alexey Smirnov" wrote:
> >> >> >
> >> >> >> sorry, I think I told you more code than you needed
> >> >> >>
> >> >> >> Dim myDirectoryEntry As DirectoryEntry
> >> >> >> myDirectoryEntry = New DirectoryEntry("LDAP://...")
> >> >> >> Console.WriteLine("EmailAddress: " &
> >> >> >> myDirectoryEntry.Properties("mail").Value)
> >> >> >>
> >> >> >> This code is working for me.
> >> >> >>
> >> >> >> Please check
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
> >> >> >> message
> >> >> >> news:D800494B-2AF6-421A-80BF-11822D3E3683@microsoft.com...
> >> >> >> > Thanks for that, i have made a little more progress now, but it
> >> >> >> > is
> >> >> >> > still
> >> >> >> > not
> >> >> >> > working. I am getting "No such object on the server", but i know
> >> >> >> > the
> >> >> >> > object
> >> >> >> > exists as it is my user!!!!
> >> >> >> >
> >> >> >> > The code is:
> >> >> >> >
> >> >> >> > Dim myDirectoryEntry As DirectoryEntry
> >> >> >> >        myDirectoryEntry = New
> >> >> >> > DirectoryEntry("LDAP://CN=""Jonathan
> >> >> >> > Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")
> >> >> >> >
> >> >> >> >        Dim ADSUser As ActiveDs.IADsUser
> >> >> >> >        ADSUser = myDirectoryEntry.NativeObject()
> >> >> >> >
> >> >> >> >
> >> >> >> >        MessageBox.Show(ADSUser.EmailAddress)
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > "Alexey Smirnov" wrote:
> >> >> >> >
> >> >> >> >> an example
> >> >> >> >>
> >> >> >> >> Imports System.DirectoryServices
> >> >> >> >>
> >> >> >> >> .....
> >> >> >> >> Dim myDirectoryEntry As DirectoryEntry
> >> >> >> >> myDirectoryEntry = New
> >> >> >> >> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >> >> >> >>
> >> >> >> >> Dim ADSUser As ActiveDs.IADsUser
> >> >> >> >> ADSUser = myDirectoryEntry.NativeObject()
> >> >> >> >>
> >> >> >> >> Regards,
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in message
> >> >> >> >> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
> >> >> >> >> >I got it, you shouldn't use old VB-GetObject function, use
> >> >> >> >> >System.DirectoryServices
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com>
> >> >> >> >> > wrote
> >> >> >> >> > in
> >> >> >> >> > message
> >> >> >> >> > news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
> >> >> >> >> >>I am developing on a Windows XP desktop connected to our
> >> >> >> >> >>domain.
> >> >> >> >> >>The
> >> >> >> >> >>domain
> >> >> >> >> >> controller is a Windows 2003 server machine
> >> >> >> >> >>
> >> >> >> >> >> "Alexey Smirnov" wrote:
> >> >> >> >> >>
> >> >> >> >> >>> what is your domain, and development machine, win2000?
> >> >> >> >> >>>
> >> >> >> >> >>>
> >> >> >> >> >>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com>
> >> >> >> >> >>> wrote
> >> >> >> >> >>> in
> >> >> >> >> >>> message
> >> >> >> >> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
> >> >> >> >> >>> >I am trying to develop an app using ADSI. I have the
> >> >> >> >> >>> >following
> >> >> >> >> >>> >code:
> >> >> >> >> >>> >
> >> >> >> >> >>> >   Dim ADSUser As IADsUser
> >> >> >> >> >>> >
> >> >> >> >> >>> >        ADSUser =
> >> >> >> >> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
> >> >> >> >> >>> >
> >> >> >> >> >>> >        MessageBox.Show(ADSUser.EmailAddress)
> >> >> >> >> >>> >
> >> >> >> >> >>> > When i try and run the program, i get the following error:
> >> >> >> >> >>> >
> >> >> >> >> >>> > Cannot create ActiveX component
> >> >> >> >> >>> >
> >> >> >> >> >>> > Any ideas what is causing this?
> >> >> >> >> >>>
> >> >> >> >> >>>
> >> >> >> >> >>>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Author
30 Mar 2006 6:28 PM
Alexey Smirnov
yes, if you have permissions to do that


Show quoteHide quote
"Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in message
news:7426231A-9585-4E30-AA0F-0EF64179CEB4@microsoft.com...
> THanks for that. What i am trying to achieve is to create a Windows
> "dashboard" that will give me key data about my Exchange server.
>
> Is this achievable by doing LDAP queries on my mail server?
>
> I want to know things like "who is the domain mail server", what version
> of
> exchange is it running, database path etc...
>
>
>
> "Alexey Smirnov" wrote:
>
>> great :-)
>>
>> I'd recommend you to use LDAP browser, where you can check schemas of
>> your
>> directory
>>
>> the free version could be found at
>> http://www.ldapadministrator.com/download/index.php
>>
>> BR,
>>
>>
>> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> message
>> news:112F9840-8420-43CB-8793-568F1C3A3278@microsoft.com...
>> > Yeah, that seems to have worked. I reckon the problem is my LDAP query
>> > is
>> > wrong. I will spend some time sorting the query syntax now.
>> >
>> > Thanks for all your help
>> >
>> > "Alexey Smirnov" wrote:
>> >
>> >> well, then try to enumerate all properties at your entry
>> >>
>> >> add this code
>> >> Dim p As String
>> >>
>> >> Dim v As Object
>> >>
>> >> For Each p In myDirectoryEntry.Properties.PropertyNames
>> >>
>> >> For Each v In myDirectoryEntry.Properties(p)
>> >>
>> >> Console.WriteLine(p & "=" & v.ToString)
>> >>
>> >> Next v
>> >>
>> >> Next p
>> >>
>> >> instead the Console.Write("EmailAddress: " &
>> >> myDirectoryEntry.Properties("mail").Value)
>> >>
>> >> You should get a list of properties/values in the Console Window
>> >>
>> >>
>> >>
>> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> >> message
>> >> news:1E595D35-7025-478C-96C1-3E17F36C7603@microsoft.com...
>> >> > The error is occurring on this line:
>> >> > Console.Write("EmailAddress: " &
>> >> > myDirectoryEntry.Properties("mail").Value)
>> >> >
>> >> > i have tried running the code as an administrative user, but get the
>> >> > same
>> >> > result
>> >> >
>> >> > "Alexey Smirnov" wrote:
>> >> >
>> >> >> Where do you use it, is it Windows app, or ASP.NET?
>> >> >> I tested it in WinForms application and my account has permissions
>> >> >> to
>> >> >> request AD.
>> >> >>
>> >> >> On which line you get that error?
>> >> >>
>> >> >> BR,
>> >> >> Alexey
>> >> >>
>> >> >>
>> >> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote in
>> >> >> message
>> >> >> news:6A98CF34-E041-4EB6-9D9E-130DF70D5B4E@microsoft.com...
>> >> >> > Sorry to be a pain, and i really appreciate your help. But, i am
>> >> >> > now
>> >> >> > getting
>> >> >> > the message "a referral was returned from the server". The code
>> >> >> > is:
>> >> >> >
>> >> >> > Dim myDirectoryEntry As DirectoryEntry
>> >> >> >        myDirectoryEntry = New DirectoryEntry("LDAP://CN=Jonathan
>> >> >> > Smith,DC=sc-file,DC=servicecentre")
>> >> >> >        Console.WriteLine("EmailAddress: " &
>> >> >> > myDirectoryEntry.Properties("mail").Value)
>> >> >> >
>> >> >> > "Alexey Smirnov" wrote:
>> >> >> >
>> >> >> >> sorry, I think I told you more code than you needed
>> >> >> >>
>> >> >> >> Dim myDirectoryEntry As DirectoryEntry
>> >> >> >> myDirectoryEntry = New DirectoryEntry("LDAP://...")
>> >> >> >> Console.WriteLine("EmailAddress: " &
>> >> >> >> myDirectoryEntry.Properties("mail").Value)
>> >> >> >>
>> >> >> >> This code is working for me.
>> >> >> >>
>> >> >> >> Please check
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> "Jonathan Smith" <JonathanSm***@discussions.microsoft.com> wrote
>> >> >> >> in
>> >> >> >> message
>> >> >> >> news:D800494B-2AF6-421A-80BF-11822D3E3683@microsoft.com...
>> >> >> >> > Thanks for that, i have made a little more progress now, but
>> >> >> >> > it
>> >> >> >> > is
>> >> >> >> > still
>> >> >> >> > not
>> >> >> >> > working. I am getting "No such object on the server", but i
>> >> >> >> > know
>> >> >> >> > the
>> >> >> >> > object
>> >> >> >> > exists as it is my user!!!!
>> >> >> >> >
>> >> >> >> > The code is:
>> >> >> >> >
>> >> >> >> > Dim myDirectoryEntry As DirectoryEntry
>> >> >> >> >        myDirectoryEntry = New
>> >> >> >> > DirectoryEntry("LDAP://CN=""Jonathan
>> >> >> >> > Smith"",CN=""Edmundson Users"",DC=SERVICECENTRE,DC=local")
>> >> >> >> >
>> >> >> >> >        Dim ADSUser As ActiveDs.IADsUser
>> >> >> >> >        ADSUser = myDirectoryEntry.NativeObject()
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >        MessageBox.Show(ADSUser.EmailAddress)
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > "Alexey Smirnov" wrote:
>> >> >> >> >
>> >> >> >> >> an example
>> >> >> >> >>
>> >> >> >> >> Imports System.DirectoryServices
>> >> >> >> >>
>> >> >> >> >> .....
>> >> >> >> >> Dim myDirectoryEntry As DirectoryEntry
>> >> >> >> >> myDirectoryEntry = New
>> >> >> >> >> DirectoryEntry("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >> >> >> >>
>> >> >> >> >> Dim ADSUser As ActiveDs.IADsUser
>> >> >> >> >> ADSUser = myDirectoryEntry.NativeObject()
>> >> >> >> >>
>> >> >> >> >> Regards,
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> "Alexey Smirnov" <removeit.hello_at_smalig.com> wrote in
>> >> >> >> >> message
>> >> >> >> >> news:ezR7i$%23UGHA.1160@TK2MSFTNGP09.phx.gbl...
>> >> >> >> >> >I got it, you shouldn't use old VB-GetObject function, use
>> >> >> >> >> >System.DirectoryServices
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > "Jonathan Smith" <JonathanSm***@discussions.microsoft.com>
>> >> >> >> >> > wrote
>> >> >> >> >> > in
>> >> >> >> >> > message
>> >> >> >> >> > news:813E9B64-5050-447B-85F9-64A60568D2A3@microsoft.com...
>> >> >> >> >> >>I am developing on a Windows XP desktop connected to our
>> >> >> >> >> >>domain.
>> >> >> >> >> >>The
>> >> >> >> >> >>domain
>> >> >> >> >> >> controller is a Windows 2003 server machine
>> >> >> >> >> >>
>> >> >> >> >> >> "Alexey Smirnov" wrote:
>> >> >> >> >> >>
>> >> >> >> >> >>> what is your domain, and development machine, win2000?
>> >> >> >> >> >>>
>> >> >> >> >> >>>
>> >> >> >> >> >>> "Jonathan Smith"
>> >> >> >> >> >>> <JonathanSm***@discussions.microsoft.com>
>> >> >> >> >> >>> wrote
>> >> >> >> >> >>> in
>> >> >> >> >> >>> message
>> >> >> >> >> >>> news:660C613A-5066-4563-A5EB-7A80C89EE1AA@microsoft.com...
>> >> >> >> >> >>> >I am trying to develop an app using ADSI. I have the
>> >> >> >> >> >>> >following
>> >> >> >> >> >>> >code:
>> >> >> >> >> >>> >
>> >> >> >> >> >>> >   Dim ADSUser As IADsUser
>> >> >> >> >> >>> >
>> >> >> >> >> >>> >        ADSUser =
>> >> >> >> >> >>> > GetObject("LDAP://CN=jonsmith,CN=users,DC=domain,DC=com")
>> >> >> >> >> >>> >
>> >> >> >> >> >>> >        MessageBox.Show(ADSUser.EmailAddress)
>> >> >> >> >> >>> >
>> >> >> >> >> >>> > When i try and run the program, i get the following
>> >> >> >> >> >>> > error:
>> >> >> >> >> >>> >
>> >> >> >> >> >>> > Cannot create ActiveX component
>> >> >> >> >> >>> >
>> >> >> >> >> >>> > Any ideas what is causing this?
>> >> >> >> >> >>>
>> >> >> >> >> >>>
>> >> >> >> >> >>>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>