Office - Code Backed Forms in Infopath

Asked By BigJohn
21-Mar-08 07:29 AM
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?XsnLocation=http://web/sites/MOSS/FormServerTemplates/Holiday+Request+Form.xsn&SaveLocation=http://web/sites/MOSS/Public/Public&Source=http://web/sites/MOSS/Public/Public/Forms/AllItems.aspx&DefaultItemOpen=1,
Form ID:
urn:schemas-microsoft-com:office: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
Active Directory
(1)
Visual Studio
(1)
InfoPath
(1)
System.DirectoryServices
(1)
Problem.Those
(1)
FormServerTemplates
(1)
DefaultItemOpen
(1)
BigJohnW
(1)
  ClayFo replied...
21-Mar-08 12:51 PM
Not seeing my initial reply so trying again.

I do not think that code is supported in a browser form.

I have a web service which queries Active Directory information and is
browser compatible.
Email me if you would like to see it.
http://www.infopathdev.com/members/clayfox.aspx
--
Clay Fox / Microsoft InfoPath MVP
www.InfoPathDev.com / The InfoPath Authority / Downloads, Samples, How-To,
Experts, Forum
  BigJohn replied...
28-Mar-08 12:16 PM
Hello Clay,

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

I have logged onto the forum, cannot find the web service. Can you direct me
please?

Thanks
  ClayFo replied...
28-Mar-08 12:21 PM
Here is a page about it.
http://www.qdabra.com/proddetail.asp?prod=QADWS
The video is pretty good.

It also comes bundled with several web services for dynamic queries of SQL
and dynamic submits which may also be of interest.
Email me if you would like to see a quick demonstration.

--
Clay Fox / Microsoft InfoPath MVP
www.InfoPathDev.com / The InfoPath Authority / Downloads, Samples, How-To,
Experts, Forum
  BigJohn replied...
28-Mar-08 01:25 PM
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
  ClayFo replied...
28-Mar-08 01:31 PM
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.

--
Clay Fox / Microsoft InfoPath MVP
www.InfoPathDev.com / The InfoPath Authority / Downloads, Samples, How-To,
Experts, Forum
Create New Account
help
Problem with ink in Word 2007 Office Odd problem. I'm trying to mark up some documents in Word 2007 (all are .docx). In some Start Ink" option in the Review Tab. . . Hi Val, If you open one of the problem documents and go to Office Button = > Prepare is the 'Mark as Final' button lit? If so Word in safe mode (hold ctrl key when starting) and then open one of the 'problem' documents do you get the same behavior. = = = = = = = = = = = = = = = Odd problem. I'm trying to mark up some
Format toolbar problem in MS Works 7.0 word processor in XP SP3 Office I have no other font dll" in Event Viewer. I have reinstalled v7.0, uninstalled it, installed v8.0, same problem, went back to v7.0. If I go to Format in the menu bar, I have Excel viewer programs to view Office programs / docs. What can I do to fix this problem ?? Works Word processor did work ok at one time. Not sure when it quit with all dll" in Event Viewer. I have reinstalled v7.0, uninstalled it, | installed v8.0, same problem, went back to v7.0. If I go to Format in the | menu bar, I have
with no results. SO, I am trying here. <br> Is there a solution to the problem where docx attachments sent from Entourage cannot be opened on the iPhone? <br> Attachments from Entourage be doing about it. In all fairness, I was not even aware there was a problem (but I might be using a different encoding method than you). Corentin - - - -- Office:Mac MVP http supports the docx format, but Entourage's encoding is not compatible. <br> There is a problem, and it is clear to me that it is MS' responsibility to fix it. <br> I 1, so believe me I have no hidden agenda here! <br> However, this is a problem that needs resolving. <br> I have sent the same file by Google Mail, Apple Mail and
of the component suddenly stops working. When testing, everything works fine in Debug mode in Visual Studio 6 (VB). But when I compile the DLL and try it out just some parts and everything works as before. The code or the component is not changed and this problem did not exist yesterday. If I unregister my COM Addin documents open as before. If I reregister it the problem starts again. So I have tried to repair AND reinstall Office. I have uninstalled the latest other fixes this morning. Also, I have a similar COM Addin for Excel but no problem there. I'm beginning to be desperate, and really hope that the problem hasn't occured
Windows cannot print due to a problem with the current printer set Office Client OS: XP Pro x64 Office 2007 Professional Plus All Word 2007, Excel does the same but gives a slight different error message. When the problem occurs I can still print to the same network printer from Wordpad or Notepad. Approx 30 can still use the same printer when the error occurs. A reboot temporarily cures the problem. The Workstation in questions has been wiped and rebuilt using the manufacturer's recovery media and Office 2007 reinstalled using a download from the Microsoft EOpen site. Problem is still occuring though. Any help would be gratefully received. Office Miscellaneous Discussions Windows XP (1