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...
sysinfo = CreateObject("ADSystemInfo")
objuser = GetObject("LDAP://" & sysinfo.UserName & "")
username = Replace(objuser.name, "CN=", "")
trimname = Replace(username, "\", "")
On Error Resume Next
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.