Displaying the Generated Form in Conjunction with OWA

The key to running the generated form is the frmRoot.asp file, which is created during form generation. To run the generated form, open frmRoot.asp. For example, this happens in CML/LitCrit when a user clicks View Critiques on DDetails.asp, the CML/LitCrit application page that displays information about a library item found in the FmLib database. On this page, users can also choose to submit or read a critique about that library item. Clicking View Critiques runs the following subroutine in DDetails.asp:

<script LANGUAGE=VBScript>
Sub ViewCritiques()
   bibno = RDS_LongDisplay.Recordset("bib#").Value
   window.location.href = "critiques.asp?bibno=" & bibno
End Sub

One thing known about this library item is the bib#, its unique identifier. In the preceding subroutine, the URL for the current window is set to the critiques.asp page, and the bibno (bib#) of the library item is passed to critiques.asp for later use.

In critiques.asp, if the user clicks Add Critique, the NewCritique subroutine is called:

Sub NewCritique()
   bibno = RDS_LongDisplay.Recordset("bib#").Value
   itemtitle = RDS_LongDisplay.Recordset("title").Value
   authname = AuthorsToString(RDS_AuthorDetail.Recordset)
   mediatype = RDS_LongDisplay.Recordset("coll").Value
   approvalreq = <%= Application("ApprovalRequired") %>
   approveremail = "<%= Application("ApproverEmail") %>"

   url = "http://<%=Application("ExchangeServer")%>/Exchange/"
   url = url & "Forms/IPM/Post/EnhancedLitCrit/frmRoot.asp?"
   url = url & "command=new&ID=<%=Application("PublicFolderObjectID")%>"
   url = url & "&BN=" & bibno & "&IT=" & itemtitle & "&AN=" & authname & "&MT=" & mediatype
   url = url & "&AR=" & approvalreq & "&AE=" & approveremail
   window.open url,"NewCritique","menubar=no,toolbar=no,status=no,location=no",False
End Sub
</script>

NewCritique opens a window, passing url, a string of parameters. This string contains a path to the frmRoot.asp page on the Microsoft Exchange Server computer. It also contains the parameter command=new. As frmRoot.asp opens, it interprets this to mean it must open a new critique, using the message.asp file. When creating a new form, you don't have an objectID in advance, so you cannot pass it. Rather you need to pass an identifier of the folder in which you want the new form created. In the NewCritique subroutine, this information is added in the following line:

url = url & "command=new&ID=<%=Application("PublicFolderObjectID")%>"

If the command=open parameter had been passed, frmRoot.asp would have opened an existing critique, using message_read.asp. The following procedure in critiques.asp opens an existing critique:

Sub DoCritique(objectID)
   url = "http://<%=Application("ExchangeServer")%>/Exchange/"
   url = url & "Forms/IPM/Post/EnhancedLitCrit/frmRoot.asp?"
   url = url & "command=open&acs=anon&obj=" & objectID
   window.open url,objectID,"menubar=no,toolbar=no,status=no,location=no",False
End Sub

In the preceding DoCritique subroutine, frmRoot.asp is opened and passed the url string variable. This string is passed as the first parameter in the open method of the window object (of the browser object model). The second parameter, objectID, uniquely identifies the critique saved in the Microsoft Exchange Server information store, and subsequent parameters define the appearance of the window. For more information on these variables, see Communicating with frmRoot.asp. For general information on the browser object model, execute the following query in the Microsoft Platform SDK on the Microsoft Developer Network (MSDN™) CD-ROM: "The Browser Object Model".