Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Accessing Infopath rules without opening Infopath form

Posted on 2008-09-30
6
Medium Priority
?
1,106 Views
Last Modified: 2010-05-18
This just may not be possible, but thought I would throw it out there:

The base question:  Is there a way to execute Infopath rules without actually opening up an Infopath form with the Infopath client?  I don't believe there are Infopath APIs to be called from .NET code but maybe I'm wrong or is there some other way to access the rules "virturally" within code.  

Background:  I work for a company that has workflow software where we can update an Infopath form with data captured within our system and we're using the Infopath form as the user interface.  We only want the user to get the Infopath form if there are errors present, otherwise send the form on to the next steps in the workflow.

We're using an Infopath 2007 form which will be published to a MOSS document library.  Using an XML doc created by opening the form and saving it without adding any data, we will then add  data.  From there we need to validate the data using the rules created within Infopath.  We know we can capture the number of validation errors to store on a field on the form to use later, but it requires quickly opening and closing the form programmatically (the rules execute on open).  Our worry is that there could be hundreds of forms opening and closing which could hog server resources and create other errors as we do this.  Ideally if there was a way to access the error count through .NET code, we wouldn't have to worry about opening and closing the form.  

Any ideas or are we just dreaming?? Thanks.
0
Comment
Question by:TicketKev
  • 2
  • 2
  • 2
6 Comments
 
LVL 28

Expert Comment

by:Clay Fox
ID: 22607620
You can open, and submit forms via code.

Research some of the command line options but deffinetly you could automate this with windows script host.
I have used a vb routine to automatically open a form while passing in data from a db and then the submit emailled it to the user info passed in. I beleive you can accomplish what you need to automate.

www.infopathdev.com should help.
0
 

Author Comment

by:TicketKev
ID: 22607700
clayfox - Thanks for your reply.  I know I can automate opening and closing the form via code, but what I need is some way to open it, get the error count with data, and close it but WITHOUT actually opening and thus firing off the Infopath client.  I guess I"m looking for a way to tap into the XSN file without the overhead of running the Infopath client.  
0
 

Author Comment

by:TicketKev
ID: 22607730
clayfox - Another question for you:  In your vb routine to open and close the form, what type of volume did it handle?  Did you experience any issues?  If we can open and close Infopath several times in a minute without anything coming back to bite us, we would feel better about just going that route.  Thanks.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 28

Expert Comment

by:Clay Fox
ID: 22611568
Your other option is to process the xml directly, replicate the logic from the form.

I had mine run once through about 1 thousand forms but did not monitor the performance.  I would think if you had the process run on submit that even with 2k users you are not going to have many simultaneous forms.
0
 
LVL 1

Accepted Solution

by:
hstaples53 earned 1500 total points
ID: 22682533
Here's a couple of ideas; either way you're basically having Infopath run in some context (whether it be an ASP.NET page or an EXE)

1) Server-side call to Infopath Forms Services

You'll still need to open the form and have the rules processed through Infopath, but I'd run the forms through Infopath Forms Services so it's done in something that's made to handle opening a bunch of forms at the same time.

To get Forms Services working for you:
* If you have MOSS Enterprise installed, then click Site Settings, Site Features, and make sure the SP Enterprise Features are activated. That'll give you Forms Services.
* Make sure your Infopath Forms is able to run in the browser. Open the form in Design Mode, click Tools | Form Options then click  Compatibility on the left and click the checkbox that says "Design a form template that can be opened in a browser or Infopath" and do a verify. After that is done, republish your form.

So, now you have a form that can run in the browser. I'm not exactly sure what the 3rd party workflow software is that you're talking about, so I'm not exactly sure what all it can do. I'd suggest reading up on the Infopath Forms Services SDK (http://msdn.microsoft.com/en-us/library/ms772301.aspx) and seeing if something there turns on the lightbulb for you. My guess is that you may want to just pass a URL to open the form in the browser and then save it. That may be all you need to do.

The reason I suggest going down this path is that, while I'm sure there's some way to do it, I'm not sure there's a good way to kick-off the Infopath rule processing without having Infopath open.

2) Build an EXE that uses the Infopath control.
Not exactly sure what your 3rd party software is, but the key thing is that you're going to need to reference the DLL located at C:\Program Files\Microsoft Office\Office12\Microsoft.Office.Infopath.FormControl.dll. At that point, you can then write code to instantiate a form control which will then host the running infopath form. Doc'n on calling that is at C:\Program Files\Microsoft Office\Office12\Microsoft.Office.Infopath.FormControl.dll

If you're serious about Infopath development, there's a 1200-page book "Designing Forms for Microsoft Office InfoPath and Forms Services 2007" which goes through a coding example of this (I keep it on my safari.oreilly.com bookshelf for reference).

Anyways, the reason I suggest either of the above two methods is that I think you're going to have to have Infopath running for the rules to get picked up on the form. The main reason is that the .xml file that holds your Infopath data doesn't have the rules in it; it's just an xml file of the data that has a reference at the top of it to the .xsn that was used to create the form. So, now, that .xsn is really just a collection of files, most importantly there's manifest.xsf which at the bottom of it will have two sections describing your rules and validations that have been created. I think it would be an exercise in frustration and limitation to try and create something that opens the .xml, then the .xsn, the the .xsf, then iterates through the rules and tries to figure out the errors.

Good luck, hope that helps.
0
 
LVL 1

Expert Comment

by:hstaples53
ID: 22682545
Soprry the documentation on creating a hosted FormControl in an EXE is at
http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.formcontrol(VS.80).aspx 
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pimping Sharepoint 2007 without Server-Side Code Part 1 One of my biggest frustrations with Sharepoint 2007 in the corporate world is that while good-intentioned managers lock down the more interesting capabilities of Sharepoint programming in…
Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question