Ways to get Current User - InfoPath Dev
in

InfoPath Dev

Ways to get Current User

Last post 08-15-2005 11:01 AM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-15-2005 06:43 AM

    Ways to get Current User

    Just thought I may share a solution I have come up with, this message board as been extremely helpful thus far and I wanted to contribute. Seems no one ever brought up this third option.

    The goal to obtain the current username.

    Assumptions:
    1 - I am working in an Intranet environment and it can be assumed I can use windows integrated security.
    2 - The client does not want to use digital signatures.
    3 – Making the form fully trusted and having to distribute *.js file is viewed as a deployment issue (they want to leverage SharePoint and not have to install anything extra on a machine).
    4 – You are leveraging the custom task pane.

    There are three approaches to getting the user name.
    1 – You can use Managed Code and use the System.Environment.UserName property to get the current user name.
    2 – Use ActiveX to get the current user name (discussed on this forum).
    3 – Use HttpContext.Current.Request.Se¬¬rverVariables["LOGON_USER"] in a web service if you are not using anonymous access.

    The Managed Code way is very easy but if you are using a custom task pane and making calls between the task pane and your InfoPath form, it will have to be fully trusted. As I mentioned making it fully trusted was not an option.

    Using ActiveX is again very simple but the form needs to be fully trusted. You do not need full trust to make calls to the custom task pane and vice versa if you are using script.

    Using the third option works well if you can remove anonymous access to your web service.
    Jason
    http://www.k2distillery.com/
  • 08-15-2005 11:01 AM In reply to

    Re: Ways to get Current User

    Cool summary. I'd also suggest one more:

    4- Use Active Directory and Web service. This option requires no code (if you use an out of the box Web service like ours - see downloads) and only requires domain trust security.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.