Getting users Username - InfoPath Dev
in

InfoPath Dev

Getting users Username

Last post 02-23-2008 09:27 AM by dpsol. 25 replies.
Page 2 of 2 (26 items) < Previous 1 2
Sort Posts: Previous Next
  • 09-14-2005 07:16 AM In reply to

    I find it hard to believe but it is happening. Post up the code you are running and let me see if I or someone else can generate the error.
    Jason
    http://www.k2distillery.com/
  • 09-14-2005 07:31 AM In reply to

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47
    here is my code for the onload

    Sub XDocument_OnLoad(eventObj)

    Dim wsh
    Set wsh = CreateObject("WScript.Network")
    un = wsh.UserName
    XDocument.DOM.selectSingleNode("//my:myFields/my:field14").text = un

    End Sub
  • 09-14-2005 07:40 AM In reply to

    The code works for me. I do not have an explanation why you are getting the error in VBScript but you run this in JScript it works.

    Where you able to try the code I posted that used Wscript.Shell?

    Anyone else run into this issue before???
    Jason
    http://www.k2distillery.com/
  • 09-14-2005 07:45 AM In reply to

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47
    Yes i tried that as well and it gave a similar error that it couldn't create wscript.shell
  • 09-14-2005 08:37 AM In reply to

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47
    is there a specific dll that must be registered for the vb to work or does the dll cover both vb and jscript?
  • 09-14-2005 11:08 PM In reply to

    Hi guys,
    Make the form Full Trust. Then it will work.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 09-15-2005 07:02 AM In reply to

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47
    That was it.

    Thanks Patrick.

    My big problem now is forms for users that don't have access to our network. I just can't seem to get that to work.
  • 09-16-2005 12:59 PM In reply to

    Ah. Extranetted forms. Search the forum (upper right search button) for the term "extranet" and you will see some stuff.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 08-03-2006 12:38 PM In reply to

    I have this code in vbScript;

    Sub XDocument_OnLoad(eventObj)
    ' Write your code here
    Dim wsh
    Dim un
    Set wsh = CreateObject("WScript.Network")
    un = wsh.UserName
    XDocument.DOM.selectSingleNode("//my:myFields/my:tmpFields/my:Field1").text = un

    End Sub

    I am trying to populate a text box (Field1) with the value of the username. I can get XDocument.UI.Alert(un) to work. but when I try to populate with above code I get "object required" error. What am I missing?
  • 08-03-2006 01:51 PM In reply to

    quote:
    Originally posted by lotusvball

    I have this code in vbScript;

    Sub XDocument_OnLoad(eventObj)
    ' Write your code here
    Dim wsh
    Dim un
    Set wsh = CreateObject("WScript.Network")
    un = wsh.UserName
    XDocument.DOM.selectSingleNode("//my:myFields/my:tmpFields/my:Field1").text = un

    End Sub

    I am trying to populate a text box (Field1) with the value of the username. I can get XDocument.UI.Alert(un) to work. but when I try to populate with above code I get "object required" error. What am I missing?



    Nevermind...
    XDocument.DOM.selectSingleNode("//my:myFields/my:tmpFields/my:Field1").text = un should have been

    XDocument.DOM.selectSingleNode("//dfs:myFields/my:tmpFields/my:Field1").text = un


    duh.....
  • 02-23-2008 09:27 AM In reply to

    • dpsol
    • Not Ranked
    • Joined on 02-20-2008
    • Posts 2

    Hi,

    I am new to infoPath2003 and been reading this post and how do you add this code into infopath?  I am trying to get the current user that opens the form onto a test field also.

    kinda clueless on my way around infoPath.

    thanks for any help.

    Sol

     

Page 2 of 2 (26 items) < Previous 1 2
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.