Active Directory and Navision 4.0

HildeHilde Member Posts: 3
Does anybody know how to retrieve information from AD into a report?
In SQL2005 we work with groups in stead of usernames and I need to retrieve employee.no.

I tried with an ODBC connection but I can not get it to work.
CREATE(ADOcnn);
CnnStr := 'PROVIDER=ADsDSOObject';
ADOcnn.Open(CnnStr);

CREATE(ADOrst)
strSQL := 'SELECT ADsPath FROM 'LDAP://dc=domain,dc=nl'';
ADOrst.Open(strSQL,ADOcnn)

Thanks in advance.

Comments

  • kinekine Member Posts: 12,562
    1) What does it mean "n SQL2005 we work with groups in stead of usernames"? It is not clear for me...
    2) Take a look at virtual tables 2000000050..2000000056. I think that it is what you need.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • HildeHilde Member Posts: 3
    We used to login with our windows username. Now we belong to a group and you see the groupname in de usersetup.

    I just want to be able to talk to the active directory in stead.
    Do you know how?

    Hilde
  • kinekine Member Posts: 12,562
    Once again:
    2) Take a look at virtual tables 2000000050..2000000056. I think that it is what you need. :wink:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • BGIBGI Member Posts: 176
    Ok long time ago this mail, but to continue.
    In the 2000050 you have all the ad users/groups etc...
    Can anyone point me in the direction on how to proceed from there to pe. change the phone number in the AD for a particular user..

    Object is to update from employee card certain data in the ad, so we don't have to put them in twice....

    Rgds
    Benny
    Rgds
    Benny Giebens
  • kinekine Member Posts: 12,562
    You cannot change the data in AD from NAV.

    1) he user will need to have permissions on AD to do that
    2) You can use some automation to do that, but not through Virtual tables.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • BGIBGI Member Posts: 176
    1) permissions is not a problem.
    2) i know i need to use automation, the problems is what controls, and how to use them......so if someone has some code expamples it would be very helpfull!!
    Rgds
    Benny Giebens
  • ayhan06ayhan06 Member Posts: 210
    BGI wrote:
    1) permissions is not a problem.
    2) i know i need to use automation, the problems is what controls, and how to use them......so if someone has some code expamples it would be very helpfull!!

    i didn't search which automation can be used in Nav but i think you can use this solution simply:

    1. here is my vb code that i used 4 years ago to update objects in ad.
    Set objUser = GetObject("LDAP://CN=" & "DisplayName of user" & ",OU=" & "OrganizationalUnit of user" & ",dc=xxxx,dc=xxx,dc=edu,dc=tr")
    objUser.Put "pwdLastSet", -1
    intUAC = objUser.Get("userAccountControl")
    objUser.Put "userAccountControl", intUAC XOR ADS_UF_DONT_EXPIRE_PASSWD
    objUser.AccountExpirationDate = "01/01/1970"
    objUser.AccountDisabled = FALSE
    objUser.SetInfo
    objUser.SetPassword "PassWord"
    set ObjUser = Nothing
    

    2. change above code lines because it should take parameters from command line.(i am supposing that you are familiar with vbscript)
    3. save the above code into a .vbs file.
    4. call cscript.exe or wscript.exe to run that vbs file from Navision with parameters..(you can use "windows scrpting host object".wshshell).

    google will give you lots of examples of vb scripts to do that.

    also you can save the vb codes as txt files, not vbs files. cscript.exe or wscript.exe will run them properly..

    hope this help..
Sign In or Register to comment.