How to Populate Current User in Form Without Needing a Code Signing Certificate


On my Blog I have two code samples that talk about pulling the Current User information based on the user's authentication to Active Directory and populating it into a form.   One sample uses JScript and the other uses VB.Net.    The JScript sample requires that the solution be signed with a Level 2 code signing certificate.    Alternatively you can deploy the solution as an MSI using a tool in the Resource Kit, but that turns out to be somewhat problematic over time (breaks slick deployment and update model).   I'm not sure about the second VB.Net sample, I haven't tested it myself and so not sure 100% how it works and what might be needed to have that code run.   I do know of another code sample that uses C# to do the same thing, and I have tested it and it works without requiring a signing cert.    That code and the walkthough on how to use it is here    For the benefit of the Blog, the actual code you need is here:

// store an XMLDOM node as a local variable
IXMLDOMNode nodeEmployee =
if(nodeEmployee != null){
      if(nodeEmployee.text == ""){
         // if the employee name is blank when we load the form,
         // populate the employee node with the current user name
nodeEmployee.text = System.Environment.UserName;

Pretty simple, huh?