Here is a posting from Tom Mata, a colleague of mine from Armstrong Industries, who found an alternate way to reach into AD and get information on the current logged on user (compare and contrast this to Lab 15 in the InfoPath Labs that I reference on 10/17/05).

 

I had been looking and looking for a way to populate fields when a form load in Infopath for a while.  I finally got it to work and for anyone that is interested here you go.  This will bind to the current logged in user and retrieve values from their user object.  I would also imagine that this can be changed to query for computer and group objects as well.  But if anyone was in my situation this shoudl get you started.
 
To start with I used the Infopath vbscript template and in the onload event goes this code, which would have to be changed baed on your form...
 
 Dim sysinfo
            Dim objuser
            Dim username
            Dim OrgName
            Dim trimname
            sysinfo = CreateObject("ADSystemInfo")
            objuser = GetObject("LDAP://" & sysinfo.UserName & "")
            username = Replace(objuser.name, "CN=", "")
            trimname = Replace(username, "\", "")

            On Error Resume Next
            Dim objusername
            Dim objdivision
            Dim objsubmitbyphone
            Dim objsubmitofficeloc
            Dim reqnum
            Dim trimdivision
            objusername = thisXDocument.DOM.selectSingleNode("my:myFields/my:SubmitBy")
            objusername.text = trimname
            objdivision = thisXDocument.DOM.selectSingleNode("my:myFields/my:Division")
            trimdivision = Right(objuser.distinguishedName, "OU=")
            objdivision.text = trimdivision
            objsubmitbyphone = thisXDocument.DOM.selectSingleNode("my:myFields/my:SubmitByPhone")
            objsubmitbyphone.text = objuser.telephonenumber
            objsubmitofficeloc = thisXĊ ocument.DOM.selectSingleNode("my:myFields/my:Location")
            objsubmitofficeloc.text = objuser.physicaldeliveryofficename
            reqnum = thisXDocument.DOM.selectSingleNode("my:myFields/my:reqNum")
            reqnum.text = Int(999990999 * Rnd())
 
This code was done in Visual Studio 2003 in VB.Net.