This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
This walkthrough shows you how to automatically populate an InfoPath 2007 form with information about the current user by utilizing data stored in Active Directory.
Even though not intended as a tutorial on InfoPath 2007 programming, this walkthrough will also introduce you to some basic programming tasks in InfoPath 2007: enumerating through form elements, programmatically setting an element value, etc.
Please, follow this link for detailed screencast of the solution.
Related links:
"Design Once" and the new InfoPath 2007 Object Model
The .NET Developer's Guide to Directory Services Programming