UserName bug(?) for forms published to SP library - InfoPath Dev
in

InfoPath Dev

UserName bug(?) for forms published to SP library

Last post 08-16-2005 07:57 AM by pmbarnes. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-15-2005 03:23 PM

    UserName bug(?) for forms published to SP library

    I've got a managed form I'm publishing to a SharePoint Team site Forms Library on a domain controller. I've discovered that calling Environment.UserName in the form's OnLoad event handler essentially causes a silent runtime error, preventing any code that follows in the handler from executing. I think this bug can be reproduced by creating a simple form, adding an OnLoad event handler and then putting the following in the handler:

    e.XDocument.UI.Alert(Environment.UserName)
    e.XDocument.UI.Alert("test msg")

    This will appear to work fine in Preview mode. But when I publish this template to my SharePoint Form library and run it from the server or a client box none of the alerts appear when the form loads. If I reverse the above two lines of code, the "test msg" alert will fire and nothing else.

    Has anyone seen this?

    UPDATE: I think this is an issue with Full Trust. I had seen postings from others that Environment.UserName didn't require Full Trust. But maybe they're not on a DC. I just signed the form with a self-issued cert and it did access Environment.UserName when I opened the form from the Form library on the server. When I tried the same on the client box I got an error saying the form could not load because the cert either expired or was revoked. Must be that it was self-issued. This is progress. I will post back if I've resolved this. Might be helpful for someone in the future.
  • 08-15-2005 03:54 PM In reply to

    Re: UserName bug(?) for forms published to SP library

    Sounds like a permissions issue. Is this running Domain trust? What zone is URL in? It should be in IntraNet zone not Internet or Trusted. Please check in IE.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 08-15-2005 04:45 PM In reply to

    Re: UserName bug(?) for forms published to SP library

    I have it in Trusted Sites. If I puthttp://<my server name> in IntraNet zone, when I click to the button to query an Access db I get a dialog stating "This Web site uses a data provider that may be unsafe. If you trust the Web site click OK, otherwise click Cancel." If I click OK I get another dialog stating "This Web site is using your identity to access a data source. If you trust the Web site click OK, otherwise click Cancel."

    When I add the site to Trusted Sites I don't get these dialogs.
  • 08-15-2005 10:54 PM In reply to

    Re: UserName bug(?) for forms published to SP library

    But, it works and fills in username, right?

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 08-16-2005 07:57 AM In reply to

    Re: UserName bug(?) for forms published to SP library

    Yes, it does work. I wasn't aware of the Advanced option to "Show a notification for managed code errors." With that turned on I do see the Security exception. So feel free to move this thread out of the Bugs folder : ).

    Now if I can just get around those Access database connection issues without having to fully trust the *site* (and thus lose the ability to call Environment.UserName without a fully trusted *form*), all will be well.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.