Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / August 2007

Tip: Looking for answers? Try searching our database.

Uploading infopath form with managed code to MOSS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian Farnhill - 31 Jul 2007 08:04 GMT
Hey,

I have an infopath form that I want to try in the web browser just to see if
it runs. It only has a single text field that in the startup event of the
form populates with the users windows name. The code I use is

When I upload the form into the central administration of the MOSS server I
get these errors:

MainDataSource.CreateNavigator.SelectSingleNode("/my:myFields/my:field1",
NamespaceManager).SetValue(System.Environment.UserName)

This operation is not allowed at this time.  
There is an error in the InternalStartup method of form code.

Any ideas what is casuing this?
S.Y.M. Wong-A-Ton - 31 Jul 2007 09:56 GMT
The InternalStartup is for hooking up event handlers by InfoPath. Remove your
code from the InternalStartup and try putting it in the Loading event (Tools
> Programming > Loading Event) or in the Changed event of a control.
---
S.Y.M. Wong-A-Ton

> Hey,
>
[quoted text clipped - 12 lines]
>
> Any ideas what is casuing this?
Brian Farnhill - 31 Jul 2007 22:42 GMT
Thanks, that got it uploaded and I could put it into a forms library.

Now I don't suppose you could help me with somethign else related to the
same issue. I am basically trying to prepopulate one of the fields with the
current users windows name when the form loads, using that line of code
below. I need to form to run as a web page (in the browser, so the clients
are not required to have infopath installed). When I go to create a new form
it tells me that an error occured loading the form. Any ideas why or what I
can do?

> The InternalStartup is for hooking up event handlers by InfoPath. Remove your
> code from the InternalStartup and try putting it in the Loading event (Tools
[quoted text clipped - 18 lines]
> >
> > Any ideas what is casuing this?
David Dean - 01 Aug 2007 01:46 GMT
Have you tried the userName() function? This function was introduced in
InfoPath 2007 and returns the user's Windows login ID. You can use this
function as the default value for a form element.

See http://blogs.msdn.com/infopath/archive/2006/05/26/608092.aspx for
additional details.

Signature

David Dean
Sr. Member Technical Staff
Insource Technology Corp.

> Thanks, that got it uploaded and I could put it into a forms library.
>
[quoted text clipped - 28 lines]
> > >
> > > Any ideas what is casuing this?
Brian Farnhill - 01 Aug 2007 02:46 GMT
Thanks David. I read that blog post and I changed to code to get the users
logon with Application.User.UserName instead of System.Environment.UserName
and it works perfectly.

The function also worked, but my end game for the forms I'm working on would
involved managed code that queires a web service to return properties on the
user from some of our line of business systems and then prepopulating the
form with that information - I dont really want to have a field with thier
username on the form at all.

Thanks again for the info, this has definately pointed me in the right
direction!

> Have you tried the userName() function? This function was introduced in
> InfoPath 2007 and returns the user's Windows login ID. You can use this
[quoted text clipped - 35 lines]
> > > >
> > > > Any ideas what is casuing this?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.