current user? - InfoPath Dev
in

InfoPath Dev

current user?

Last post 04-19-2005 12:44 AM by Shanthi Reddy. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 04-06-2005 11:22 PM

    current user?

    i'm looking for a mechanism to extract the current user's detail into my form.

    i've googled & found 2 ways:
    1) through a web service:
    http://weblogs.asp.net/wkriebel/archive/2005/01/24/359669.aspx
    --> I don't understand what it means by "[MyPortal]" though..

    2) using help from Visual Studio .NET 2003
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ip2003_tr/html/odc_INF_Lab_15.asp
    --> don't have the software installed just yet..

    is there any other way to achieve this besides the above methods?
    also, can anyone explain to me what it means by the sentence "the name of your SharePoint Portal Server 2003 instance" ?
  • 04-07-2005 07:53 AM In reply to

    Hello,
    For the 1st way mentioned above, you need to have Sharepoint Portal servive installed (this is different from Windows Sharepoint services -> previously called as Sharepoint Team Services [STS]). When they say "the name of your SharePoint Portal Server 2003 instance" they mean where you have Sharepoint Portal server installed. Or in other words if you want to go to the home page of your Sharepoint server, the link that is used likehttp://system2/sites

    The second option is one that we have used a lot of times - System.Environment.UserName and it has worked very well for us.

    Shanthi
    InfoPathDev India
    Shanthi Reddy
  • 04-11-2005 11:54 AM In reply to

    • BrownR
    • Top 200 Contributor
    • Joined on 08-14-2004
    • USA
    • Posts 54
    quote:
    Originally posted by Shanthi

    Hello,
    For the 1st way mentioned above, you need to have Sharepoint Portal servive installed (this is different from Windows Sharepoint services -> previously called as Sharepoint Team Services [STS]). When they say "the name of your SharePoint Portal Server 2003 instance" they mean where you have Sharepoint Portal server installed. Or in other words if you want to go to the home page of your Sharepoint server, the link that is used likehttp://system2/sites

    The second option is one that we have used a lot of times - System.Environment.UserName and it has worked very well for us.

    Shanthi
    InfoPathDev India



    I still use the "Username" method. Works like a charm.
  • 04-12-2005 01:31 AM In reply to

    Currently i'm using another method that is more convinient for me..

    http://www.infopathfaq.com/development.asp?postid=710

    So, it's working with ActiveXObject("WScript.network") object instead.
  • 04-12-2005 07:38 AM In reply to

    It looks like "WScript.network" requires Full trust and therefore signing of the template if you want to publish the solution. The "UserName" method does not need the solution to be full trust. That is the reason we use this more.

    Shanthi
    InfoPathDev India
    Shanthi Reddy
  • 04-13-2005 01:08 PM In reply to

    • BrownR
    • Top 200 Contributor
    • Joined on 08-14-2004
    • USA
    • Posts 54
    quote:
    Originally posted by Shanthi

    It looks like "WScript.network" requires Full trust and therefore signing of the template if you want to publish the solution. The "UserName" method does not need the solution to be full trust. That is the reason we use this more.

    Shanthi
    InfoPathDev India



    Is this true? My form still required me to have the form trusted.
  • 04-16-2005 03:59 PM In reply to

    So what would the code look like to use System.Environment.UserName in the on load event to get the username into a text box? I realize this is probably a stuped question but I'm new to Infopath and java.
  • 04-16-2005 11:47 PM In reply to

    If it is in InfoPath you need select the xml node and set the value to that node. And bind that xml node to a textbox in the UI.
    Code would look like

    thisXDocument.DOM.selectSingleNode(...<You need to write the XML XPAth here>...).text = System.Environment.UserName;

    Note: Above code in "c#".

    Agni
    InfopathDev India
  • 04-18-2005 01:27 PM In reply to

    OK so here is the code that I have in my event:

    function XDocument::OnLoad(oEvent)

    {
    // Avoid DOM updates when the document has been digitally signed.
    if (XDocument.IsSigned)
    return;

    var now = new Date();
    initializeNodeValue("/ar:absenceRequest/ar:date", getDateString(now));
    initializeNodeValue("/ar:absenceRequest/ar:time", getTimeString(now));

    }

    IXMLDOMNode nodeAlias = thisXDocument.DOM.selectSingleNode("ar:contact/my:Alias");
    nodeEmployee.text = System.Environment.UserName;

    The error that I get is as follows:

    InfoPath cannot open the selected form because of an error in the form's code.
    The following error occurred:

    Expected ';'
    File:script.js
    Line:34
    IXMLDOMNode nodeAlias = thisXDocument.DOM.selectSingleNode("ar:contact/my:Alias")

    Could you shed any light on what is going on. I know VB pretty well but java is new to me.
  • 04-18-2005 05:35 PM In reply to

    Sorry, I noticed a typo the last line of my current code should read:

    nodeAlias.text = System.Environment.UserName;
  • 04-19-2005 12:44 AM In reply to

    Hello stuarts,
    As Agni mentioned above this is a C# method and therefore will work in C# only.

    About full trust and System.Environment.UserName -> Domain level trust is enough for this. It does not need full trust.

    Shanthi
    InfoPathDev India
    Shanthi Reddy
Page 1 of 1 (11 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.