Infopath 2003 equivalent of infopath 2007 Username() function - InfoPath Dev
in

InfoPath Dev

Infopath 2003 equivalent of infopath 2007 Username() function

Last post 07-09-2009 06:18 AM by Kugelblitz. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 12-22-2008 11:54 AM

    Infopath 2003 equivalent of infopath 2007 Username() function

    Hi,

    With the help of userName() function in Infopath 2007 we can get the name of the current user filling/editing the form. But the situation I am in is that, I have developed a form in Infopath 2007 in a way that its also compatible with Infopath 2003. But I have used the username() function in infopath 2007 & it is definetly not compatible with infopath 2003, this is the only part were theres a problem of compatbility. SO if I want to make that part work (i.e. getting the name of the current user filling the form) in 2003 as well what are all the options I have?

    Bcz I do not want to right any script or managed code for this purpose.

    Please let me know what other options I can consider to make it compatible & any pros & cons of each.
    I need to get around this bcz some of the user has office infopath 2003 & others have 2007 with them.

    Thanks,

  • 12-22-2008 07:39 PM In reply to

    Re: Infopath 2003 equivalent of infopath 2007 Username() function

    Hi,

    There is no equivalent function in InfoPath 2003 for username() in Infopath 2007. To get the user name we have to write the code. Use the following code to get the current user name.

    String userName = System.Environment.UserName;

     

    Swathip
    www.ggktech.com
  • 12-23-2008 06:20 AM In reply to

    Re: Infopath 2003 equivalent of infopath 2007 Username() function

    Hi Swathip,

     

    Ya I agree thats one way to do it through cutom code. But as I said I cannot go for the option of writing script/c# managed code as that feature is not enabled & my client doesnt want to go that way. What about making my 2007 form browser enabled with full trust & deploy it that way using central admin "upload form template page" I guess thats the only way left, if I dont want to go with writing custom code. Any how thanks for ur reply.

     

     

  • 12-23-2008 09:39 AM In reply to

    Re: Infopath 2003 equivalent of infopath 2007 Username() function

    Why do you need to do full trust + administratively approved?  You can do the regular browser form with the userName() function and use the GetUserProfileByName web service all day long without having to do full trust or anything complicated unless you have some other unknown restriction.

  • 12-29-2008 04:49 AM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 525

    Re: Infopath 2003 equivalent of infopath 2007 Username() function

    Hi,

    You can use the UserProfileService from Sharepoint to get the current user name. It will work with IP 2003, see

     http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-_2D00_-Get-the-current-user-without-writing-code.aspx for the details

    Anuma Chinthapalli /
    http://www.GGKTech.com
  • 12-29-2008 05:07 AM In reply to

    Re: Infopath 2003 equivalent of infopath 2007 Username() function

    If you do not have SharePoint and this feature is crucial, you might consider trying Qdabra's Active Directory Web Service.  It will allow you to retrieve the current user's name and a whole bunch of other information: http://www.qdabra.com/en/products/ADWebService.aspx

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-29-2008 10:02 AM In reply to

    Re: Infopath 2003 equivalent of infopath 2007 Username() function

    Can you explain how this works with IP2003?  The User Profile Service requires the username as the query parameter, so how can you use it to get the username if you don't already know the username?  The way it works in IP2007 is that you configure the form to automatically send the current user's username to the web service upon opening the form, and then it retrieves that user's profile information.  Or, you can set it to run the query during use of the form dynamically or manually, but you still have to send a username to run the query on the web service.  How would you do this if you don't already know the username?  You can't have the chicken before the egg...

  • 07-09-2009 06:18 AM In reply to

    Re: Infopath 2003 equivalent of infopath 2007 Username() function

    swathip:

    Hi,

    There is no equivalent function in InfoPath 2003 for username() in Infopath 2007. To get the user name we have to write the code. Use the following code to get the current user name.

    String userName = System.Environment.UserName;

     

    I'm sorry, but this method does'nt work with my form. I think, I've to tell my form to use 'System'. But I don't know how to do so. I've got only Microsoft Skript Editor 10.0 to edit the code in my form. All the hints i found till now seemed to refer to Visual Studio. Can you please tell me how to get these method work.

    Kugelblitz

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