Simple Automation with Infopath 2003 and SPS 3.0 - Calculate Directory / Filename to save as
Posted on 2009-12-30
I have a simple Infopath Form with various text fields, date fields, option buttons, etc. I have published to form to a sharepoint "server" (actually, a server running SPS 3.0 -- the free version). I would like to add two command buttons (say "btnDrafts" and "btnSubmit"), with the caption "Save As Draft" and "Submit to Policy Committee".
If the user clicks on btnDraft, the form would be saved in a Drafts subfolder of the current location of the empty template, in SPS, with a concatenation of the last name of the author (txtAuthorLastName (textbox)), the title of the policy (txtTitle), the current system date (in YYYYMMDD) format, and the letters "DRF" (e.g., DoeWorkHours20091230DRF).
If the user clicks on btnSubmit, the form would be saved in a "Submit to Policy Committee" subfolder of the current location of the empty template, in SPS, with the same name, except without the "DRF" at the end (e.g., "DoeWorkHours20091230").
While the user can obviously save the form wherever they want, I'm not worried about restricting them, at this point, from saving it elsewhere using the file : Save As... menu.
Realizing that Infopath 2007 and Sharepoint Server might be more amenable to this process, it is unfortunately ruled out due to financial restrictions.
I'd prefer to use VBScript over JScript (assuming I have to use either) to perform this task, because I'm more use to Visual Basic .NET (we have Visual Studio 2008). I'm really not that familiar with the Object Model, and getting a solid model to a tangible example in our situation might greatly assist in learning it.