How to get the Windows Login UserID from Infopath

V

Venkatesh

Hi, Here we are working with Infopath, sharepoint and Biztalk. All the 3 are
at different locations. The problem iam facing is iam not able to get the
username from the infoptah.

The scenario is something like this. The user will loging to the sharepoint
portal, then he will go to one formlibrary and will click on Fillout form.
Then the Infopath form will open, that time based on the user role i need to
hide/display some of the sections in Infopath. But iam not able to get the
userid from the infopath when it is in network.
Any help regarding this?
Thanks in advance.
 
J

Jamesy

wow! I may finally be able to offer something back!

Assuming that you have access to SQL Server .....

1) Create dummy database with public access
2) Create a new data connection to the database using windows authentication
and edit the SQL to ;

select system_user

(You'll be warned that no tree-view can be created, but just OK that)

3) Create a text-field (hidden) and add a rule that if blank set value to
the C* field of the connection that you have just created.

Viola, when the form loads, the field is populated with the users
domain\userid

Jamesy
 
S

Sandeep

C# code:

public void OnLoad(DocReturnEvent e)
{


setNodeValue("Your Xml path", System.Environment.UserName);

}
 
Top