Code Backed Forms in Infopath

B

BigJohnW

Hi,
I have created an infopath form which contains fields for Active Directory
lookups. Several fields query the AD and display user related data - Name,
Title, Manager, stuff like that. I've signed the form with a certificate and
published the form successfully to Sharepoint (MOSS2007) so that it published
in a browser. However, when I try to open the form in a browser from
Sharepoint, before the form is displayed, it errors and says an error has
been entered into the Server Application Event log. This is a 5337 error ID
and states:

Business logic failed due to an exception. (User: Domain\MyUserName, Form
Name: Holiday Request Form, IP: , Request:
http://web/_layouts/FormServer.aspx.../Public/Forms/AllItems.aspx&DefaultItemOpen=1,
Form ID:
urn:schemas-microsoft-com:eek:ffice:infopath:Holiday-Request-Form:-myXSD-2008-03-07T12-43-21,
Type: COMException, Exception Message: An operations error occurred.)

If I click continue, the form displays correctly in a browser but without
the code based fields being populated.

I've been told in another Forum (Sharepoint Portal Server) that this is a
problem with the code I have used. However, when I preview the form inside
Infopath (2007) the form loads and displays correctly and all fields are
properly populated, so I assumed the code is correct.

I can post my code here if required.

I have added a reference for System.DirectoryServices and put Imports
System.DirectoryServices at the top of the form. I then posted my code to the
Loading Event and when I build the form inside Microsot Visual Studio Tools
for Applications the form builds error free.

I don't think I've missed anything , except the code, which I can post if
required.

Please can anyone advise on why I am getting this error and how to cure it
so that my form loads properly in a browser and populates the required fields?

Many Thanks

John
 
B

BigJohnW

Hello Clay,

Thaks for the reply, sorry its taken a while to reply, been very busy!

I've logged onto the forum, can't find the web service. Can you direct me
please?

Thanks
 
B

BigJohnW

Hi Clay,

Thanks for the Post, I've had a look, seems pretty good.
I'm not 100% sure about whether we need to buy a Web Service.
Can anyone else confirm that code cannot be used in an infopath form?
I have been posting on another MS Site prior to this one and nobody said
there browser froms can't be code based.
Can anyone out there confirm this? The form performs perfectly in Infopath
during preview.
I got the base code off a post on a different Newsgroup, it seemed to imply
you could put code into forms.
I know if I ask my boss to buyt the Web Service, he will ask these
questions, so I'm just covering my bases.
Thanks for your help earlier, Clay, I'm not disputing you are wrong, just
checking.
No offense intended.
Regards,
John
 
C

Clay Fox

No Problem.

Those are legitimate questions.

You can run code in Browser based forms fine.

The issue becomes what the code is doing and trust issues.

Also since your form is in the browser, there is less interactivity, post
backs are handled differently.
There may be some code that will work in a browser to get userid.

The nice thing with the AD web service is that it is reusable and easy for
form designers to use. It is codeless so you can publish browser forms with
out the additional steps of Admin approval and you can use it to get
additional employee information such as email, department, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top